Crazy Eddie's GUI System  ${CEGUI_VERSION}
SamplesFrameworkBase Class Referenceabstract

This is a base class that is intended to be used for all sample applications. Here we take care of common things such the renderer selection and application startup. More...

+ Inheritance diagram for SamplesFrameworkBase:
+ Collaboration diagram for SamplesFrameworkBase:

Public Member Functions

 SamplesFrameworkBase ()
 Constructor.
 
virtual ~SamplesFrameworkBase ()
 Destructor.
 
int run ()
 Application entry point. More...
 
virtual bool initialise ()=0
 Sample specific initialisation goes here. This method is called by the application base object created as part of the initialise call. More...
 
virtual void deinitialise ()=0
 deinitialise the resources allocated in the initialise if needed.
 
virtual void update (float passedTime)=0
 Update function called before rendering.
 
virtual void handleNewWindowSize (float width, float height)=0
 Update function for window size changes.
 
virtual void renderGUIContexts ()=0
 Draw function to draw GUIContexts.
 
virtual bool injectKeyDown (const CEGUI::Key::Scan &ceguiKey)=0
 Function to inject key down to GUIContexts. More...
 
virtual bool injectKeyUp (const CEGUI::Key::Scan &ceguiKey)=0
 Function to inject key up to GUIContexts. More...
 
virtual bool injectChar (int character)=0
 Function to inject characters to GUIContexts. More...
 
virtual bool injectMouseButtonDown (const CEGUI::MouseButton &ceguiMouseButton)=0
 Function to inject mouse button down to GUIContexts. More...
 
virtual bool injectMouseButtonUp (const CEGUI::MouseButton &ceguiMouseButton)=0
 Function to inject mouse button up to GUIContexts. More...
 
virtual bool injectMouseWheelChange (float position)=0
 Function to inject mouse wheel changes to GUIContexts. More...
 
virtual bool injectMousePosition (float x, float y)=0
 Function to inject the mouse position to GUIContexts. More...
 
virtual void setQuitting (bool quit)
 Function to set the bool defining if the application should quit as soon as possible.
 
bool isQuitting ()
 Function returning if the application should quit as soon as possible. More...
 
void setApplicationWindowSize (int width, int height)
 Function setting the application window's size.
 

Protected Member Functions

virtual bool runApplication ()
 Initialises the sample system, this includes asking the user for a render to use and the subsequent creation of the required systems to support that renderer. More...
 
virtual void cleanup ()
 Cleans up all resources allocated by the initialise call.
 

Static Protected Member Functions

static void outputExceptionMessage (const char *message)
 Output a message to the user in some OS independant way.
 

Protected Attributes

CEGuiRendererSelectord_rendererSelector
 Points to the renderer selector object.
 
CEGuiBaseApplicationd_baseApp
 Pointer to the base application object.
 
bool d_quitting
 Bool defining if application should quit.
 
int d_appWindowWidth
 Int defining the application window's width.
 
int d_appWindowHeight
 Int defining the application window's height.
 

Detailed Description

This is a base class that is intended to be used for all sample applications. Here we take care of common things such the renderer selection and application startup.

Member Function Documentation

virtual bool SamplesFrameworkBase::initialise ( )
pure virtual

Sample specific initialisation goes here. This method is called by the application base object created as part of the initialise call.

Returns
false if something went wrong.

Implemented in SamplesFramework.

Referenced by CEGuiGLFWSharedBase::run().

virtual bool SamplesFrameworkBase::injectChar ( int  character)
pure virtual

Function to inject characters to GUIContexts.

Returns
true if event was handled.

Implemented in SamplesFramework.

Referenced by CEGuiGLFWSharedBase::endRendering().

virtual bool SamplesFrameworkBase::injectKeyDown ( const CEGUI::Key::Scan &  ceguiKey)
pure virtual

Function to inject key down to GUIContexts.

Returns
true if event was handled.

Implemented in SamplesFramework.

Referenced by CEGuiGLFWSharedBase::endRendering().

virtual bool SamplesFrameworkBase::injectKeyUp ( const CEGUI::Key::Scan &  ceguiKey)
pure virtual

Function to inject key up to GUIContexts.

Returns
true if event was handled.

Implemented in SamplesFramework.

Referenced by CEGuiGLFWSharedBase::endRendering().

virtual bool SamplesFrameworkBase::injectMouseButtonDown ( const CEGUI::MouseButton ceguiMouseButton)
pure virtual

Function to inject mouse button down to GUIContexts.

Returns
true if event was handled.

Implemented in SamplesFramework.

Referenced by CEGuiGLFWSharedBase::endRendering().

virtual bool SamplesFrameworkBase::injectMouseButtonUp ( const CEGUI::MouseButton ceguiMouseButton)
pure virtual

Function to inject mouse button up to GUIContexts.

Returns
true if event was handled.

Implemented in SamplesFramework.

Referenced by CEGuiGLFWSharedBase::endRendering().

virtual bool SamplesFrameworkBase::injectMousePosition ( float  x,
float  y 
)
pure virtual

Function to inject the mouse position to GUIContexts.

Returns
true if event was handled.

Implemented in SamplesFramework.

Referenced by CEGuiGLFWSharedBase::endRendering().

virtual bool SamplesFrameworkBase::injectMouseWheelChange ( float  position)
pure virtual

Function to inject mouse wheel changes to GUIContexts.

Returns
true if event was handled.

Implemented in SamplesFramework.

Referenced by CEGuiGLFWSharedBase::endRendering().

bool SamplesFrameworkBase::isQuitting ( )

Function returning if the application should quit as soon as possible.

Returns
true if should quit.

References d_quitting.

Referenced by CEGuiGLFWSharedBase::run().

int SamplesFrameworkBase::run ( )

Application entry point.

Returns
code to be returned by the application.

References CEGUI::String::c_str(), cleanup(), CEGUI::Exception::getMessage(), outputExceptionMessage(), and runApplication().

bool SamplesFrameworkBase::runApplication ( )
protectedvirtual

Initialises the sample system, this includes asking the user for a render to use and the subsequent creation of the required systems to support that renderer.

Returns
false if anything went wrong.

References d_baseApp, d_rendererSelector, CEGuiBaseApplication::execute(), CEGuiRendererSelector::getSelectedRendererType(), CEGuiRendererSelector::invokeDialog(), and CEGuiRendererSelector::setRendererAvailability().

Referenced by run().