Adonthell  0.4
adonthell Class Reference

This is the heart of the Adonthell engine. More...

#include <adonthell.h>

Public Member Functions

 adonthell ()
 Standard constructor. More...
 
landmapget_landmap ()
 
bool update_map ()
 
void set_update_map (bool u)
 
mapviewget_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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ adonthell()

adonthell::adonthell ( )

Standard constructor.

Definition at line 38 of file adonthell.cc.

Member Function Documentation

◆ main()

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.

Parameters
wndThe window to display initially
nameA name for that window (currently unused)

Definition at line 49 of file adonthell.cc.

◆ main_loop()

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.

◆ main_quit()

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.

◆ fade_out()

void adonthell::fade_out ( )

Fades the screen to black.

Definition at line 120 of file adonthell.cc.

◆ fade_in()

void adonthell::fade_in ( )

Fades in from a black screen.

Definition at line 138 of file adonthell.cc.

◆ get_state()

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.

Parameters
fileThe opened engine state file (mapengine.data).

Definition at line 164 of file adonthell.cc.

◆ put_state()

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.

Parameters
fileThe opened engine state file (mapengine.data).

Definition at line 189 of file adonthell.cc.

◆ control_active()

bool adonthell::control_active ( )
inline

Returns whether the control script is active or not.

Returns
  • true if that is the case.
  • false otherwise.

Definition at line 140 of file adonthell.h.

◆ set_control_active()

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.

Parameters
cPass true to enable the control script, false to disable it.

Definition at line 155 of file adonthell.h.

◆ get_landmap()

landmap* adonthell::get_landmap ( )
inline
Todo:
move landmap handling somewhere else

Definition at line 164 of file adonthell.h.

◆ update_map()

bool adonthell::update_map ( )
inline
Todo:
move landmap handling somewhere else

Definition at line 172 of file adonthell.h.

◆ set_update_map()

void adonthell::set_update_map ( bool  u)
inline
Todo:
move landmap handling somewhere else

Definition at line 180 of file adonthell.h.

◆ get_mapview()

mapview* adonthell::get_mapview ( )
inline
Todo:
move mapview handling somewhere else

Definition at line 188 of file adonthell.h.

◆ draw()

void adonthell::draw ( s_int16  x,
s_int16  y,
drawing_area da_opt = NULL,
surface target = NULL 
)
inline
Todo:
move mapview handling somewhere else

Definition at line 196 of file adonthell.h.

◆ set_mapview_schedule()

void adonthell::set_mapview_schedule ( string  s,
PyObject *  args = NULL 
)
inline
Todo:
move mapview handling somewhere else

Definition at line 205 of file adonthell.h.

◆ mapview_start()

void adonthell::mapview_start ( )
Todo:
move mapview handling somewhere else

Definition at line 208 of file adonthell.cc.

◆ mapview_stop()

void adonthell::mapview_stop ( )
Todo:
move mapview handling somewhere else

Definition at line 221 of file adonthell.cc.


The documentation for this class was generated from the following files: