dtABC::Application Class Reference

Base generic Application class. More...

#include <application.h>

Inheritance diagram for dtABC::Application:

dtABC::BaseABC dtCore::Base dtGame::GameApplication

List of all members.

Public Member Functions

 Application (const std::string &configFilename="")
virtual void Run ()
 Start the Application.
virtual bool KeyPressed (const dtCore::Keyboard *keyboard, int kc)
 Called when a key is pressed.
const
dtCore::GenericKeyboardListener
GetKeyboardListener () const
 
Returns:
the instance of the listener used for callbacks

dtCore::GenericKeyboardListenerGetKeyboardListener ()
 
Returns:
the instance of the listener used for callbacks

const std::string & GetConfigPropertyValue (const std::string &name, const std::string &defaultValue="") const
 
Returns:
a string value that is paired with the given name. The default is returned if the property is not set.

void SetConfigPropertyValue (const std::string &name, const std::string &value)
 Sets the value of a given config property.
void RemoveConfigPropertyValue (const std::string &name)
 Removes a property with the given name.
void AddView (dtCore::View &view)
 Add a view to the Viewer.
void RemoveView (dtCore::View &view)
 Remove a view to the Viewer.
void SetNextStatisticsType ()
 Cycle through the statistics modes.

Static Public Member Functions

static std::string GenerateDefaultConfigFile (const std::string &filename="config.xml")
 Generate a default configuration file.
static ApplicationConfigData GetDefaultConfigData ()
 the publicized default settings for a generated config file.

Protected Member Functions

virtual ~Application ()
virtual void PreFrame (const double deltaSimTime)
 override for preframe
virtual void Frame (const double deltaSimTime)
 override for frame
virtual void PostFrame (const double deltaSimTime)
 override for postframe
virtual void CreateInstances (const std::string &name="defaultWin", int x=100, int y=100, int width=640, int height=480, bool cursor=true, bool fullScreen=false)
 Create basic instances and set up system hooks.
bool ParseConfigFile (const std::string &file)
 Read the supplied config file, called from the constructor Read an existing data file and setup the internal class members with attributes from the data file.
const osgViewer::CompositeViewer * GetCompositeViewer () const
 
Returns:
the instance of the osgViewer::CompositeViewer

osgViewer::CompositeViewer * GetCompositeViewer ()
 
Returns:
the instance of the osgViewer::CompositeViewer


Classes

class  AppXMLApplicator
 A utility to apply the parsed data to the Application instance.


Detailed Description

Base generic Application class.

The Application class of the dtCore Application Base Class library is the base level class for most applications. It contains the basic components required for applications. An optional XML configuration file can be supplied on the constructor which contains the attributes for the internal DeltaWin, Camera, and Scene. A default Config File can be created by calling GenerateDefaultConfigFile(). This file will contain the default parameters and can be edited, then supplied to the constructor.

Typical use:

 Application *app = new Application("Mydatafile.xml");
 app->Config();
 app->Run();

Constructor & Destructor Documentation

XERCES_CPP_NAMESPACE_USE Application::Application ( const std::string &  configFilename = ""  ) 

Application::~Application (  )  [protected, virtual]


Member Function Documentation

void Application::Run (  )  [virtual]

Start the Application.

std::string dtABC::Application::GenerateDefaultConfigFile ( const std::string &  filename = "config.xml"  )  [static]

Generate a default configuration file.

This method writes out all the default attributes from the internal Application members and writes them out to a .xml file ("config.xml").

Parameters:
the file path to be used when writing.
Returns:
the file path to the newly created file, as seen by the delta3d resource management tool, unless the file already exists, then the path to the existing file is returned.

bool Application::KeyPressed ( const dtCore::Keyboard keyboard,
int  kc 
) [virtual]

Called when a key is pressed.

Parameters:
keyboard the source of the event
key the key pressed
character the corresponding character

const dtCore::GenericKeyboardListener* dtABC::Application::GetKeyboardListener (  )  const [inline]

Returns:
the instance of the listener used for callbacks

dtCore::GenericKeyboardListener* dtABC::Application::GetKeyboardListener (  )  [inline]

Returns:
the instance of the listener used for callbacks

ApplicationConfigData Application::GetDefaultConfigData (  )  [static]

the publicized default settings for a generated config file.

const std::string & Application::GetConfigPropertyValue ( const std::string &  name,
const std::string &  defaultValue = "" 
) const

Returns:
a string value that is paired with the given name. The default is returned if the property is not set.

void Application::SetConfigPropertyValue ( const std::string &  name,
const std::string &  value 
)

Sets the value of a given config property.

"i" can't be the "end()" because the insert returned false, meaning it does have that key.

void Application::RemoveConfigPropertyValue ( const std::string &  name  ) 

Removes a property with the given name.

void Application::AddView ( dtCore::View view  ) 

Add a view to the Viewer.

void Application::RemoveView ( dtCore::View view  ) 

Remove a view to the Viewer.

void dtABC::Application::SetNextStatisticsType (  ) 

Cycle through the statistics modes.

void Application::PreFrame ( const double  deltaSimTime  )  [protected, virtual]

override for preframe

Implements dtABC::BaseABC.

void Application::Frame ( const double  deltaSimTime  )  [protected, virtual]

override for frame

Implements dtABC::BaseABC.

void Application::PostFrame ( const double  deltaSimTime  )  [protected, virtual]

override for postframe

Implements dtABC::BaseABC.

void Application::CreateInstances ( const std::string &  name = "defaultWin",
int  x = 100,
int  y = 100,
int  width = 640,
int  height = 480,
bool  cursor = true,
bool  fullScreen = false 
) [protected, virtual]

Create basic instances and set up system hooks.

bool Application::ParseConfigFile ( const std::string &  file  )  [protected]

Read the supplied config file, called from the constructor Read an existing data file and setup the internal class members with attributes from the data file.

Parameters:
file the name of the data file to be parsed.
Returns:
true, if both parsing and applying went well.

const osgViewer::CompositeViewer* dtABC::Application::GetCompositeViewer (  )  const [inline, protected]

Returns:
the instance of the osgViewer::CompositeViewer

osgViewer::CompositeViewer* dtABC::Application::GetCompositeViewer (  )  [inline, protected]

Returns:
the instance of the osgViewer::CompositeViewer


http://www.delta3d.org
2.0.0 generated 14 Feb 2008