![]() |
Public API Reference |
![]() |
Crystal Space demo application framework class. More...
#include <cstool/demoapplication.h>
Public Member Functions | |
virtual bool | Application () |
Base implementation of the method inherited from csApplicationFramework. | |
DemoApplication (const char *applicationName) | |
Constructor. | |
virtual void | OnExit () |
Base implementation of the method inherited from csApplicationFramework. | |
virtual bool | OnInitialize (int argc, char *argv[]) |
Base implementation of the method inherited from csApplicationFramework. | |
Protected Member Functions | |
virtual bool | CreateRoom () |
Default initialization for the creation of the main sector (DemoApplication::room). | |
virtual void | Frame () |
Base implementation of the method inherited from csBaseEventHandler. | |
virtual const char * | GetApplicationConfigFile () |
Return VFS path of an additional config file to load at initialization Override this if you wish to use an application-specific config file on top of demoapplication.cfg . | |
virtual bool | OnKeyboard (iEvent &event) |
Base implementation of the method inherited from csBaseEventHandler. | |
virtual bool | OnMouseMove (iEvent &event) |
Base implementation of the method inherited from csBaseEventHandler. | |
virtual void | PrintHelp () |
Print the help message for this application on standard output. | |
Protected Attributes | |
csRef < CS::Utility::iCameraManager > | cameraManager |
Reference to the default camera manager. | |
csConfigAccess | config |
Access to the configuration manager system. | |
csRef< iEngine > | engine |
Reference to the engine. | |
csRef< iGraphics2D > | g2d |
Reference to the 2D graphics. | |
csRef< iGraphics3D > | g3d |
Reference to the 3D graphics. | |
csRef< CS::Utility::iHUDManager > | hudManager |
Reference to the default HUD manager. | |
csRef< iKeyboardDriver > | kbd |
Reference to the keyboard driver. | |
csRef< iLoader > | loader |
Reference to the loader. | |
csRef< iMouseDriver > | mouse |
Reference to the mouse driver. | |
csVector2 | previousMouse |
Previous position of the mouse cursor during the last frame. | |
csRef< FramePrinter > | printer |
Reference to the frame printer. | |
csRef< iSector > | room |
Reference to the main sector. | |
csRef< iVirtualClock > | vc |
Reference to the virtual clock. | |
csRef< iVFS > | vfs |
Reference to the virtual file system. | |
csRef< iView > | view |
Reference to the view. | |
csRef< CS::Debug::iVisualDebugger > | visualDebugger |
Visual debugger. |
Crystal Space demo application framework class.
This class and its companions provide the basic functionalities for Crystal Space's demo and test applications. Most demos, tests and tutorials would want to use this class in order to simplify their code, make it more pertinent for the user, and unify the graphical and general layout between all applications.
The functionalities provided by this class are:
Here is an example for the most simple use of this class:
//-------------------------- // example.h #include "cstool/csdemoapplication.h" class MyApp : public CS::Utility::DemoApplication { public: MyApp(); bool Application (); }; //-------------------------- // example.cpp #include "cssysdef.h" #include "example.h" MyApp::MyApp () : DemoApplication ("CrystalSpace.MyApp", "myapplication", "myapplication", "Description of 'myapplication'.") { // Configure the options for DemoApplication } bool MyApp::Application () { // Default behavior from DemoApplication if (!DemoApplication::Application ()) return false; // Initialize here your application // Default behavior from DemoApplication for the creation of the scene if (!CreateRoom ()) return false; // Create here the main objects of your scene // Run the application Run(); return true; } //-------------------------- // main.cpp #include "cssysdef.h" #include "example.h" CS_IMPLEMENT_APPLICATION int main (int argc, char* argv[]) { return MyApp ().Main (argc, argv); }
Definition at line 141 of file demoapplication.h.
CS::Utility::DemoApplication::DemoApplication | ( | const char * | applicationName | ) |
Constructor.
applicationName | Name of the application, used to set csApplicationFramework::SetApplicationName(). |
virtual bool CS::Utility::DemoApplication::Application | ( | ) | [virtual] |
Base implementation of the method inherited from csApplicationFramework.
It opens the main application, find references to the engine objects, creates the main view used for rendering, and initializes the HUD manager.
Implements csApplicationFramework.
virtual bool CS::Utility::DemoApplication::CreateRoom | ( | ) | [protected, virtual] |
Default initialization for the creation of the main sector (DemoApplication::room).
It creates a sector of name "room", adds a grey uniform background far away, initializes the camera and add some lights.
virtual void CS::Utility::DemoApplication::Frame | ( | ) | [protected, virtual] |
Base implementation of the method inherited from csBaseEventHandler.
It initializes the previous position of the mouse cursor, renders the view and displays the visual debugging information if any.
Reimplemented from csBaseEventHandler.
virtual const char* CS::Utility::DemoApplication::GetApplicationConfigFile | ( | ) | [inline, protected, virtual] |
Return VFS path of an additional config file to load at initialization Override this if you wish to use an application-specific config file on top of demoapplication.cfg
.
Definition at line 234 of file demoapplication.h.
virtual void CS::Utility::DemoApplication::OnExit | ( | ) | [virtual] |
Base implementation of the method inherited from csApplicationFramework.
It closes the frame printer.
Reimplemented from csApplicationFramework.
virtual bool CS::Utility::DemoApplication::OnInitialize | ( | int | argc, |
char * | argv[] | ||
) | [virtual] |
Base implementation of the method inherited from csApplicationFramework.
It loads all base plugins, and registers itself to the event queue.
Implements csApplicationFramework.
virtual bool CS::Utility::DemoApplication::OnKeyboard | ( | iEvent & | event | ) | [protected, virtual] |
Base implementation of the method inherited from csBaseEventHandler.
It checks for the "Help" or "Esc" keys.
Reimplemented from csBaseEventHandler.
virtual bool CS::Utility::DemoApplication::OnMouseMove | ( | iEvent & | event | ) | [protected, virtual] |
Base implementation of the method inherited from csBaseEventHandler.
It simply updates the previousMouse position.
Reimplemented from csBaseEventHandler.
virtual void CS::Utility::DemoApplication::PrintHelp | ( | ) | [protected, virtual] |
Print the help message for this application on standard output.
You may need to implement this method in order to print out the commanline options of your application.
Reference to the default camera manager.
Definition at line 187 of file demoapplication.h.
csConfigAccess CS::Utility::DemoApplication::config [protected] |
Access to the configuration manager system.
Definition at line 194 of file demoapplication.h.
csRef<iEngine> CS::Utility::DemoApplication::engine [protected] |
Reference to the engine.
Definition at line 156 of file demoapplication.h.
csRef<iGraphics2D> CS::Utility::DemoApplication::g2d [protected] |
Reference to the 2D graphics.
Definition at line 162 of file demoapplication.h.
csRef<iGraphics3D> CS::Utility::DemoApplication::g3d [protected] |
Reference to the 3D graphics.
Definition at line 160 of file demoapplication.h.
Reference to the default HUD manager.
Definition at line 184 of file demoapplication.h.
csRef<iKeyboardDriver> CS::Utility::DemoApplication::kbd [protected] |
Reference to the keyboard driver.
Definition at line 164 of file demoapplication.h.
csRef<iLoader> CS::Utility::DemoApplication::loader [protected] |
Reference to the loader.
Definition at line 158 of file demoapplication.h.
csRef<iMouseDriver> CS::Utility::DemoApplication::mouse [protected] |
Reference to the mouse driver.
Definition at line 174 of file demoapplication.h.
csVector2 CS::Utility::DemoApplication::previousMouse [protected] |
Previous position of the mouse cursor during the last frame.
It can be used to know the distance travelled by comparing it to "mouse->GetLastX/Y".
Definition at line 178 of file demoapplication.h.
csRef<FramePrinter> CS::Utility::DemoApplication::printer [protected] |
Reference to the frame printer.
Definition at line 170 of file demoapplication.h.
csRef<iSector> CS::Utility::DemoApplication::room [protected] |
Reference to the main sector.
Definition at line 181 of file demoapplication.h.
csRef<iVirtualClock> CS::Utility::DemoApplication::vc [protected] |
Reference to the virtual clock.
Definition at line 166 of file demoapplication.h.
csRef<iVFS> CS::Utility::DemoApplication::vfs [protected] |
Reference to the virtual file system.
Definition at line 172 of file demoapplication.h.
csRef<iView> CS::Utility::DemoApplication::view [protected] |
Reference to the view.
Definition at line 168 of file demoapplication.h.
Visual debugger.
Definition at line 191 of file demoapplication.h.