periapsis_app Class Reference

#include <periapsis_app.hpp>

Inheritance diagram for periapsis_app:

Inheritance graph
[legend]
Collaboration diagram for periapsis_app:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 43 of file periapsis_app.hpp.


Public Member Functions

void init ()
 This function is called by the constructor. Do not call it yourself.
 periapsis_app (const gsgl::string &title, const int &argc, const char **argv)
void update ()
 This function is called after every frame. Do not call it yourself.
 ~periapsis_app ()
Virtual Functions
virtual void cleanup ()
 This function when the application ends. Do not call it yourself.
virtual bool draw ()
 This function is called for every frame. Do not call it yourself. If it returns false and the sim pointer is valid, the sim's draw function is called.
virtual bool handle_event (const SDL_Event &e)
 Handles SDL events.
Accessors
platform::display * get_console ()
widget * get_focus_widget ()
 Return the widget with the current keyboard focus.
platform::budget * get_global_budget ()
scenegraph::node * get_global_scenery ()
void get_mousedown_info (int &button, int &x, int &y)
scenegraph::simulation * get_simulation ()
string & get_title ()
data::simple_stack< widget * > & get_widgets ()
Game Lifecycle Functions
const gsgl::data::list
< package * > & 
get_loaded_packages () const
void load_and_run_simulation (const string &fname, gsgl::scenegraph::context *c)
 Loads and runs a simulation. This will set the top widget to be invisible.
void load_package (const string &fname)
 Load a game package containing specifications for shared libraries, scenery, and vehicles.
void load_scenery (platform::synchronized< string > &status_string)
void quit_application ()
 Quits the application. Unloads and quits any simulation loaded.
void run ()
void unload_and_quit_simulation ()
 Unloads and quits a simulation. This will set the top widget to be visible, so make sure that any extra widgets have been popped off the stack.
void unload_scenery ()

Static Public Member Functions

static T * global_instance ()

Static Public Attributes

System Configuration Variables
static data::config_variable
< gsgl::string
EVENT_MAP_PATH
 The program's event map.
static data::config_variable
< gsgl::string
PROGRAM_PATH
 The path that the program is running in.
static data::config_variable
< gsgl::string
SYS_DATA_PATH
 The directory of the system data.
static data::config_variable
< gsgl::string
USER_CONFIG_PATH
 The program's user config file.
static data::config_variable
< gsgl::string
USER_DATA_PATH
 The user's data directory.

Protected Types

enum  app_state {
  APP_NO_STATE = 0, APP_INITIALIZING, APP_UI_RUNNING, APP_SIM_LOADING,
  APP_SIM_RUNNING, APP_QUITTING, APP_DEAD
}

Protected Attributes

widget * focus_widget
platform::budget * global_budget
platform::display * global_console
scenegraph::context * global_context
scenegraph::event_map * global_mapper
scenegraph::node * global_scenery
scenegraph::simulation * global_simulation
data::list< package * > loaded_packages
platform::texture * splash_screen
app_state state
gsgl::string title
data::simple_stack< widget * > widgets

Member Enumeration Documentation

enum app_state [protected, inherited]

Enumerator:
APP_NO_STATE 
APP_INITIALIZING 
APP_UI_RUNNING 
APP_SIM_LOADING 
APP_SIM_RUNNING 
APP_QUITTING 
APP_DEAD 

Definition at line 90 of file application.hpp.


Constructor & Destructor Documentation

periapsis_app ( const gsgl::string title,
const int &  argc,
const char **  argv 
)

Definition at line 55 of file periapsis_app.cpp.

~periapsis_app (  ) 

Definition at line 61 of file periapsis_app.cpp.


Member Function Documentation

void cleanup (  )  [virtual, inherited]

This function when the application ends. Do not call it yourself.

Implement this if cleanup is needed after the main loop terminates.

Definition at line 613 of file application.cpp.

Referenced by application::quit_application().

bool draw (  )  [virtual, inherited]

This function is called for every frame. Do not call it yourself. If it returns false and the sim pointer is valid, the sim's draw function is called.

Implement this to draw the simulation in a custom manner.

If this is not implemented or returns false, the sim will be updated and drawn automatically.

Definition at line 601 of file application.cpp.

Referenced by application::run().

platform::display* get_console (  )  [inline, inherited]

Definition at line 145 of file application.hpp.

Referenced by periapsis_app::init().

widget* get_focus_widget (  )  [inline, inherited]

Return the widget with the current keyboard focus.

Definition at line 150 of file application.hpp.

platform::budget* get_global_budget (  )  [inline, inherited]

Definition at line 147 of file application.hpp.

scenegraph::node* get_global_scenery (  )  [inline, inherited]

Definition at line 144 of file application.hpp.

const gsgl::data::list<package *>& get_loaded_packages (  )  const [inline, inherited]

Definition at line 160 of file application.hpp.

void get_mousedown_info ( int &  button,
int &  x,
int &  y 
) [inherited]

scenegraph::simulation* get_simulation (  )  [inline, inherited]

Definition at line 146 of file application.hpp.

string& get_title (  )  [inline, inherited]

Definition at line 142 of file application.hpp.

Referenced by periapsis_app::init().

data::simple_stack<widget *>& get_widgets (  )  [inline, inherited]

Definition at line 149 of file application.hpp.

static T* global_instance (  )  [inline, static, inherited]

bool handle_event ( const SDL_Event &  e  )  [virtual, inherited]

Handles SDL events.

Implement this to handle SDL events other than through the default scene graph event handler.

Does not normally need to be reimplemented, as UI elements and scenegraph events will propagate by default.

If it returns true, the scene graph event handler will NOT be called. If it returns false, and the current simulation pointer is valid, then the event mapper will be called with the simulation's set event targets.

Definition at line 587 of file application.cpp.

Referenced by application::run().

void init (  )  [virtual]

This function is called by the constructor. Do not call it yourself.

Implement this if initialization is needed prior to the main loop.

Reimplemented from application.

Definition at line 67 of file periapsis_app.cpp.

References application::get_console(), display::get_height(), application::get_title(), display::get_width(), main_window::HEIGHT, application::widgets, and main_window::WIDTH.

void load_and_run_simulation ( const string fname,
gsgl::scenegraph::context c 
) [inherited]

void load_package ( const string fname  )  [inherited]

Load a game package containing specifications for shared libraries, scenery, and vehicles.

Definition at line 204 of file application.cpp.

References application::loaded_packages, and string::w_string().

Referenced by application::application().

void load_scenery ( platform::synchronized< string > &  status_string  )  [inherited]

void quit_application (  )  [inherited]

Quits the application. Unloads and quits any simulation loaded.

This contains the main event loop of the application. It clears the screen, calls draw(), draws UI elements, and flips the buffers.

Definition at line 276 of file application.cpp.

References application::APP_QUITTING, application::cleanup(), application::global_simulation, application::state, and application::unload_and_quit_simulation().

Referenced by application::run().

void run (  )  [inherited]

void unload_and_quit_simulation (  )  [inherited]

void unload_scenery (  )  [inherited]

Definition at line 785 of file application.cpp.

References application::global_scenery.

void update (  )  [virtual]

This function is called after every frame. Do not call it yourself.

Reimplemented from application.

Definition at line 79 of file periapsis_app.cpp.


Member Data Documentation

config_variable< string > EVENT_MAP_PATH [static, inherited]

The program's event map.

Definition at line 134 of file application.hpp.

Referenced by application::application(), and application::get_config_overrides().

widget* focus_widget [protected, inherited]

Definition at line 111 of file application.hpp.

Referenced by application::~application().

platform::budget* global_budget [protected, inherited]

platform::display* global_console [protected, inherited]

scenegraph::context* global_context [protected, inherited]

scenegraph::event_map* global_mapper [protected, inherited]

scenegraph::node* global_scenery [protected, inherited]

scenegraph::simulation* global_simulation [protected, inherited]

data::list<package *> loaded_packages [protected, inherited]

Definition at line 106 of file application.hpp.

Referenced by application::load_package(), and application::load_scenery().

config_variable< string > PROGRAM_PATH [static, inherited]

The path that the program is running in.

Definition at line 131 of file application.hpp.

Referenced by package::package().

platform::texture* splash_screen [protected, inherited]

app_state state [protected, inherited]

config_variable< string > SYS_DATA_PATH [static, inherited]

gsgl::string title [protected, inherited]

config_variable< string > USER_CONFIG_PATH [static, inherited]

The program's user config file.

Definition at line 135 of file application.hpp.

Referenced by application::get_config_overrides().

config_variable< string > USER_DATA_PATH [static, inherited]

The user's data directory.

Definition at line 133 of file application.hpp.

Referenced by application::get_config_overrides().

data::simple_stack<widget *> widgets [protected, inherited]


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

Generated on Sat Mar 1 13:50:08 2008 for Periapsis Project by  doxygen 1.5.5