Package horizons :: Package gui :: Package widgets :: Module minimap :: Class _MinimapTransform
[hide private]
[frames] | no frames]

Class _MinimapTransform

source code

Instance Methods [hide private]
 
__init__(self, world_dimensions, location, rotation=0, use_rotation=True) source code
 
set_rotation(self, rotation) source code
 
set_use_rotation(self, use_rotation) source code
 
world_to_minimap(self, coords)
Complete coord transformation, batteries included.
source code
 
minimap_to_world(self, coords) source code
 
_update_parameters(self)
Update the transformation parameters.
source code
 
_get_rotation(self) source code
 
iter_points(self)
Return an iterator over the pixels of a minimap of the given world.
source code
 
get_min_y(self, x) source code
 
get_max_y(self, x) source code
 
get_min_x(self, y) source code
 
get_max_x(self, y) source code
Method Details [hide private]

__init__(self, world_dimensions, location, rotation=0, use_rotation=True)
(Constructor)

source code 
Parameters:
  • world_dimensions - Rect, specifying the size of the world
  • location - Rect, specifying the place and size of the area to draw to
  • rotation - integer giving minimap rotation in degrees. Might act weird with other values than 45, 135, 225 and 315
  • use_rotation - boolean, if this is false no rotation is used

set_rotation(self, rotation)

source code 
Parameters:
  • rotation - integer giving rotation in degrees the rotation only does something when use_rotation is True

world_to_minimap(self, coords)

source code 

Complete coord transformation, batteries included.

Parameters:
  • coords - tuple of two numbers representing a coordinate in the world

minimap_to_world(self, coords)

source code 
Parameters:
  • coords - tuple of two numbers representing a point in the minimap

_update_parameters(self)

source code 

Update the transformation parameters. This is only executed at the begin and when the map rotation changes. This should improve performance

iter_points(self)

source code 

Return an iterator over the pixels of a minimap of the given world.

For every pixel, a tuple (x, y) is returned. These are the x and y coordinates.