Adonthell
0.4
|
Allows you to display a landmap on a specified area of a surface. More...
#include <mapview.h>
Public Member Functions | |
mapview () | |
Default constructor. More... | |
~mapview () | |
Destructor. More... | |
void | resize (u_int16 l, u_int16 h) |
Resize the mapview. More... | |
void | set_schedule (string file, PyObject *args=NULL) |
Assign a schedule to the mapview. More... | |
string | schedule_file () |
Returns the name of the mapview's current schedule. More... | |
bool | update () |
Updates the mapview's state and launchs his schedule. More... | |
void | draw (s_int16 x, s_int16 y, const drawing_area *da_opt=NULL, surface *target=NULL) const |
Draw the object on the screen. More... | |
void | attach_map (landmap *m) |
Attach/Detach a map. More... | |
void | detach_map () |
Stops displaying a map. More... | |
s_int8 | set_pos (u_int16 sm, u_int16 x, u_int16 y, s_int16 ox=0, s_int16 oy=0) |
Position settings. More... | |
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. More... | |
u_int16 | currentsubmap () |
Position information. More... | |
u_int16 | posx () const |
Returns the X position of the mapview. More... | |
u_int16 | posy () const |
Returns the Y position of the mapview. More... | |
u_int16 | offx () const |
Returns the X offset of the mapview. More... | |
u_int16 | offy () const |
Returns the Y offset of the mapview. More... | |
bool | can_scroll_right () |
Basic movment. More... | |
bool | can_scroll_left () |
Returns whether it is possible to scroll to left. More... | |
bool | can_scroll_up () |
Returns whether it is possible to scroll to up. More... | |
bool | can_scroll_down () |
Returns whether it is possible to scroll to down. More... | |
void | scroll_right () |
Scrolls 1 pixel to right, if possible. More... | |
void | scroll_left () |
Scrolls 1 pixel to left, if possible. More... | |
void | scroll_down () |
Scrolls 1 pixel to down, if possible. More... | |
void | scroll_up () |
Scrolls 1 pixel to up, if possible. More... | |
s_int8 | get_state (igzstream &file) |
State saving/loading. More... | |
s_int8 | put_state (ogzstream &file) |
Saves the mapview's state into an opened file. More... | |
![]() | |
drawable () | |
Default constructor. More... | |
virtual | ~drawable () |
Destructor. More... | |
u_int16 | length () const |
Returns the length of the drawable. More... | |
u_int16 | height () const |
Returns the height of the drawable. More... | |
virtual bool | input_update () |
Virtual input update function, provided for objects which doesn't need one. More... | |
Additional Inherited Members | |
![]() | |
void | set_length (u_int16 l) |
Sets the length of the drawable. More... | |
void | set_height (u_int16 h) |
Sets the height of the drawable. More... | |
Allows you to display a landmap on a specified area of a surface.
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.
mapview::mapview | ( | ) |
Default constructor.
Definition at line 29 of file mapview.cc.
mapview::~mapview | ( | ) |
Destructor.
Definition at line 40 of file mapview.cc.
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 | ( | ) |
Stops displaying a map.
Definition at line 53 of file mapview.cc.
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.
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.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void mapview::scroll_right | ( | ) |
Scrolls 1 pixel to right, if possible.
Definition at line 107 of file mapview.cc.
void mapview::scroll_left | ( | ) |
Scrolls 1 pixel to left, if possible.
Definition at line 120 of file mapview.cc.
void mapview::scroll_down | ( | ) |
Scrolls 1 pixel to down, if possible.
Definition at line 133 of file mapview.cc.
void mapview::scroll_up | ( | ) |
Scrolls 1 pixel to up, if possible.
Definition at line 146 of file mapview.cc.
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.
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.
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.
|
inline |
|
virtual |
Updates the mapview's state and launchs his schedule.
Reimplemented from drawable.
Reimplemented in win_object< mapview >.
Definition at line 263 of file mapview.cc.
|
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.