Adonthell 0.4
|
This is the heart of the Adonthell engine. More...
#include <adonthell.h>
Public Member Functions | |
adonthell () | |
Standard constructor. | |
landmap * | get_landmap () |
bool | update_map () |
void | set_update_map (bool u) |
mapview * | get_mapview () |
void | draw (s_int16 x, s_int16 y, drawing_area *da_opt=NULL, surface *target=NULL) |
void | set_mapview_schedule (string s, PyObject *args=NULL) |
void | mapview_start () |
void | mapview_stop () |
The engine's main loop | |
void | main (win_base *wnd=NULL, const string name="") |
Starts the main loop. | |
void | main_loop () |
The actual main loop. | |
void | main_quit () |
Quit the main loop. | |
Fading | |
void | fade_out () |
Fades the screen to black. | |
void | fade_in () |
Fades in from a black screen. | |
Saving and Loading | |
s_int8 | get_state (igzstream &file) |
Restore the engine's state. | |
s_int8 | put_state (ogzstream &file) |
Save the engine's state. | |
Additional game control | |
bool | control_active () |
Returns whether the control script is active or not. | |
void | set_control_active (bool c) |
Set whether the control script should be executed or not. |
This is the heart of the Adonthell engine.
All activities, be it checking for user input, calculating a new game state and finally rendering a scene are done in the main loop.
This class works together closely with the window manager which provides the basic GUI control methods and the gametime class which is responsible for synchronising Adonthell to the machine it is running on.
Definition at line 40 of file adonthell.h.
adonthell::adonthell | ( | ) |
Standard constructor.
Definition at line 34 of file adonthell.cc.
void adonthell::main | ( | win_base * | wnd = NULL , |
const string | name = "" |
||
) |
Starts the main loop.
Since having the mainloop running without a window to display seems to make no sense, you'll have to pass an inital window when starting the main loop. This method can be called multiple times. Only those windows belonging to the outermost main loop are updated and recieve user input. However, all windows are drawn in correct order, i.e. innermost first, outermost last.
See the window manager for more details.
wnd | The window to display initially |
name | A name for that window (currently unused) |
Definition at line 45 of file adonthell.cc.
void adonthell::main_loop | ( | ) |
The actual main loop.
First, any user input is processed, then the new game state is calculated and finally all open (and visible) windows are rendered and displayed on screen. This (currently) happens up to 50 times per second.
Definition at line 80 of file adonthell.cc.
void adonthell::main_quit | ( | ) |
Quit the main loop.
This stops the outermost main loop and closes all windows associated with that loop. It does not delete them however. For that you'll have to call win_manager::destroy ().
Definition at line 110 of file adonthell.cc.
void adonthell::fade_out | ( | ) |
Fades the screen to black.
Definition at line 116 of file adonthell.cc.
void adonthell::fade_in | ( | ) |
Fades in from a black screen.
Definition at line 134 of file adonthell.cc.
s_int8 adonthell::get_state | ( | igzstream & | file | ) |
Restore the engine's state.
Loads the previously displayed map, it's state and the state of the mapview from mapengine.data.
file | The opened engine state file (mapengine.data). |
Definition at line 152 of file adonthell.cc.
s_int8 adonthell::put_state | ( | ogzstream & | file | ) |
Save the engine's state.
Writes the current map w/ it's state and the state of the mapview to mapengine.data.
file | The opened engine state file (mapengine.data). |
Definition at line 177 of file adonthell.cc.
bool adonthell::control_active | ( | ) | [inline] |
Returns whether the control script is active or not.
Definition at line 136 of file adonthell.h.
void adonthell::set_control_active | ( | bool | c | ) | [inline] |
Set whether the control script should be executed or not.
This script provides functionality that is not directly related to contolling the main character, like opening the main menu, the load or save screen, etc.
c | Pass true to enable the control script, false to disable it. |
Definition at line 151 of file adonthell.h.
landmap* adonthell::get_landmap | ( | ) | [inline] |
Definition at line 160 of file adonthell.h.
bool adonthell::update_map | ( | ) | [inline] |
Definition at line 168 of file adonthell.h.
void adonthell::set_update_map | ( | bool | u | ) | [inline] |
Definition at line 176 of file adonthell.h.
mapview* adonthell::get_mapview | ( | ) | [inline] |
Definition at line 184 of file adonthell.h.
void adonthell::draw | ( | s_int16 | x, |
s_int16 | y, | ||
drawing_area * | da_opt = NULL , |
||
surface * | target = NULL |
||
) | [inline] |
Definition at line 192 of file adonthell.h.
void adonthell::set_mapview_schedule | ( | string | s, |
PyObject * | args = NULL |
||
) | [inline] |
Definition at line 201 of file adonthell.h.
void adonthell::mapview_start | ( | ) |
Definition at line 196 of file adonthell.cc.
void adonthell::mapview_stop | ( | ) |
Definition at line 209 of file adonthell.cc.