#include <mapview.h>


Public Member Functions | |
| mapview () | |
| Default constructor. | |
| ~mapview () | |
| Destructor. | |
| void | resize (u_int16 l, u_int16 h) |
| Resize the mapview. | |
| void | set_schedule (string file, PyObject *args=NULL) |
| Assign a schedule to the mapview. | |
| string | schedule_file () |
| Returns the name of the mapview's current schedule. | |
| bool | update () |
| Updates the mapview's state and launchs his schedule. | |
| void | draw (s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const |
| Draw the object on the screen. | |
| void | attach_map (landmap *m) |
| Attach/Detach a map. | |
| void | detach_map () |
| Stops displaying a map. | |
| s_int8 | set_pos (u_int16 sm, u_int16 x, u_int16 y, s_int16 ox=0, s_int16 oy=0) |
| Position settings. | |
| s_int8 | center_on (u_int16 sm, u_int16 x, u_int16 y, s_int16 ox=0, s_int16 oy=0) |
| Sets the position of the center of the mapview on the map. | |
| u_int16 | currentsubmap () |
| Position information. | |
| u_int16 | posx () const |
| Returns the X position of the mapview. | |
| u_int16 | posy () const |
| Returns the Y position of the mapview. | |
| u_int16 | offx () const |
| Returns the X offset of the mapview. | |
| u_int16 | offy () const |
| Returns the Y offset of the mapview. | |
| bool | can_scroll_right () |
| Basic movment. | |
| bool | can_scroll_left () |
| Returns whether it is possible to scroll to left. | |
| bool | can_scroll_up () |
| Returns whether it is possible to scroll to up. | |
| bool | can_scroll_down () |
| Returns whether it is possible to scroll to down. | |
| void | scroll_right () |
| Scrolls 1 pixel to right, if possible. | |
| void | scroll_left () |
| Scrolls 1 pixel to left, if possible. | |
| void | scroll_down () |
| Scrolls 1 pixel to down, if possible. | |
| void | scroll_up () |
| Scrolls 1 pixel to up, if possible. | |
| s_int8 | get_state (igzstream &file) |
| State saving/loading. | |
| s_int8 | put_state (ogzstream &file) |
| Saves the mapview's state into an opened file. | |
This class just acts as a "camera" which takes snapshots of a landmap. It's size can be specified, a schedule can be set to update it's movment. Nothing prevents you from having several mapviews on the same map that displays each a different (or similar) part of the landmap.
Definition at line 44 of file mapview.h.
| mapview::mapview | ( | ) |
| mapview::~mapview | ( | ) |
| void mapview::attach_map | ( | landmap * | m | ) |
Attach/Detach a map.
Sets which map this mapview will display.
| m | pointer to the map that will be displayed by the mapview. |
Definition at line 46 of file mapview.cc.
| void mapview::detach_map | ( | ) |
| s_int8 mapview::set_pos | ( | u_int16 | sm, | |
| u_int16 | x, | |||
| u_int16 | y, | |||
| s_int16 | ox = 0, |
|||
| s_int16 | oy = 0 | |||
| ) |
Position settings.
Sets the position of the top-left corner of the mapview on the map.
You'll probably don't want to use this method. To center the mapview on a precise position, see center_on () instead.
| sm | submap. | |
| x | X position. | |
| y | Y position. | |
| ox | X offset. | |
| oy | Y offset. |
Definition at line 60 of file mapview.cc.
| s_int8 mapview::center_on | ( | u_int16 | sm, | |
| u_int16 | x, | |||
| u_int16 | y, | |||
| s_int16 | ox = 0, |
|||
| s_int16 | oy = 0 | |||
| ) |
Sets the position of the center of the mapview on the map.
| sm | submap. | |
| x | X position. | |
| y | Y position. | |
| ox | X offset. | |
| oy | Y offset. |
Definition at line 90 of file mapview.cc.
| u_int16 mapview::currentsubmap | ( | ) | [inline] |
| u_int16 mapview::posx | ( | ) | const [inline] |
| u_int16 mapview::posy | ( | ) | const [inline] |
| u_int16 mapview::offx | ( | ) | const [inline] |
| u_int16 mapview::offy | ( | ) | const [inline] |
| bool mapview::can_scroll_right | ( | ) | [inline] |
| bool mapview::can_scroll_left | ( | ) | [inline] |
| bool mapview::can_scroll_up | ( | ) | [inline] |
| bool mapview::can_scroll_down | ( | ) | [inline] |
| void mapview::scroll_right | ( | ) |
| void mapview::scroll_left | ( | ) |
| void mapview::scroll_down | ( | ) |
| void mapview::scroll_up | ( | ) |
| s_int8 mapview::get_state | ( | igzstream & | file | ) |
State saving/loading.
Restore the mapview's state from an opened file.
| file | the opened file from which to load the state. |
Definition at line 168 of file mapview.cc.
| s_int8 mapview::put_state | ( | ogzstream & | file | ) |
Saves the mapview's state into an opened file.
| file | the opened file where to the state. |
Definition at line 201 of file mapview.cc.
| void mapview::resize | ( | u_int16 | l, | |
| u_int16 | h | |||
| ) |
Resize the mapview.
The parameters are given in pixels.
| l | new length. | |
| h | new height. |
Definition at line 159 of file mapview.cc.
| void mapview::set_schedule | ( | string | file, | |
| PyObject * | args = NULL | |||
| ) |
Assign a schedule to the mapview.
The schedule's filename will be "scripts/schedules/mapviews/<file>.py".
| file | name of the schedule to use. | |
| args | Python tuple containing extra arguments passed to the class constructor. |
Definition at line 230 of file mapview.cc.
| string mapview::schedule_file | ( | ) | [inline] |
| bool mapview::update | ( | ) | [virtual] |
Updates the mapview's state and launchs his schedule.
Reimplemented from drawable.
Definition at line 263 of file mapview.cc.
| void mapview::draw | ( | s_int16 | x, | |
| s_int16 | y, | |||
| const drawing_area * | da_opt = NULL, |
|||
| surface * | target = NULL | |||
| ) | const [virtual] |
Draw the object on the screen.
| x | X position where to draw. | |
| y | Y position where to draw. | |
| da_opt | optional drawing_area to use during the drawing operation. | |
| target | pointer to the surface where to draw the drawable. If NULL, draw on the screen. |
Implements drawable.
Definition at line 270 of file mapview.cc.
1.5.6