Adonthell
0.4
|
This is the heart of the Adonthell engine. More...
#include <adonthell.h>
Public Member Functions | |
adonthell () | |
Standard constructor. More... | |
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. More... | |
void | main_loop () |
The actual main loop. More... | |
void | main_quit () |
Quit the main loop. More... | |
Fading | |
void | fade_out () |
Fades the screen to black. More... | |
void | fade_in () |
Fades in from a black screen. More... | |
Saving and Loading | |
s_int8 | get_state (igzstream &file) |
Restore the engine's state. More... | |
s_int8 | put_state (ogzstream &file) |
Save the engine's state. More... | |
Additional game control | |
bool | control_active () |
Returns whether the control script is active or not. More... | |
void | set_control_active (bool c) |
Set whether the control script should be executed or not. More... | |
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 44 of file adonthell.h.
adonthell::adonthell | ( | ) |
Standard constructor.
Definition at line 38 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 49 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 84 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 114 of file adonthell.cc.
void adonthell::fade_out | ( | ) |
Fades the screen to black.
Definition at line 120 of file adonthell.cc.
void adonthell::fade_in | ( | ) |
Fades in from a black screen.
Definition at line 138 of file adonthell.cc.
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 164 of file adonthell.cc.
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 189 of file adonthell.cc.
|
inline |
Returns whether the control script is active or not.
Definition at line 140 of file adonthell.h.
|
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 155 of file adonthell.h.
|
inline |
Definition at line 164 of file adonthell.h.
|
inline |
Definition at line 172 of file adonthell.h.
|
inline |
Definition at line 180 of file adonthell.h.
|
inline |
Definition at line 188 of file adonthell.h.
|
inline |
Definition at line 196 of file adonthell.h.
|
inline |
Definition at line 205 of file adonthell.h.
void adonthell::mapview_start | ( | ) |
Definition at line 208 of file adonthell.cc.
void adonthell::mapview_stop | ( | ) |
Definition at line 221 of file adonthell.cc.