Crazy Eddie's GUI System  ${CEGUI_VERSION}
SamplesFrameworkBase.h
1 /***********************************************************************
2  created: 24/9/2004
3  author: Paul D Turner
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  ***************************************************************************/
27 #ifndef _SamplesFrameworkBase_h_
28 #define _SamplesFrameworkBase_h_
29 
30 // forward declarations
33 
34 #include "CEGUI/InputEvent.h"
35 
43 {
44 public:
50 
51 
56  virtual ~SamplesFrameworkBase();
57 
58 
66  int run();
67 
68 
77  virtual bool initialise() = 0;
78 
79 
84  virtual void deinitialise() = 0;
85 
90  virtual void update(float passedTime) = 0;
91 
96  virtual void handleNewWindowSize(float width, float height) = 0;
97 
102  virtual void renderGUIContexts() = 0;
103 
110  virtual bool injectKeyDown(const CEGUI::Key::Scan& ceguiKey) = 0;
111 
118  virtual bool injectKeyUp(const CEGUI::Key::Scan& ceguiKey) = 0;
119 
126  virtual bool injectChar(int character) = 0;
127 
134  virtual bool injectMouseButtonDown(const CEGUI::MouseButton& ceguiMouseButton) = 0;
135 
142  virtual bool injectMouseButtonUp(const CEGUI::MouseButton& ceguiMouseButton) = 0;
143 
150  virtual bool injectMouseWheelChange(float position) = 0;
151 
158  virtual bool injectMousePosition(float x, float y) = 0;
159 
164  virtual void setQuitting(bool quit);
165 
172  bool isQuitting();
173 
178  void setApplicationWindowSize(int width, int height);
179 
180 protected:
189  virtual bool runApplication();
190 
191 
196  virtual void cleanup();
197 
198 
203  static void outputExceptionMessage(const char* message);
204 
205  /*************************************************************************
206  Data fields
207  *************************************************************************/
210 
211  bool d_quitting;
212 
215 };
216 
217 #endif // end of guard _SamplesFrameworkBase_h_
Base class for the renderer selection dialog class.
Definition: CEGuiRendererSelector.h:56
bool isQuitting()
Function returning if the application should quit as soon as possible.
Definition: SamplesFrameworkBase.cpp:317
static void outputExceptionMessage(const char *message)
Output a message to the user in some OS independant way.
Definition: SamplesFrameworkBase.cpp:302
virtual void setQuitting(bool quit)
Function to set the bool defining if the application should quit as soon as possible.
Definition: SamplesFrameworkBase.cpp:312
virtual bool injectChar(int character)=0
Function to inject characters to GUIContexts.
virtual void update(float passedTime)=0
Update function called before rendering.
virtual ~SamplesFrameworkBase()
Destructor.
Definition: SamplesFrameworkBase.cpp:103
MouseButton
Enumeration of mouse buttons.
Definition: cegui/include/CEGUI/InputEvent.h:209
virtual bool injectMouseWheelChange(float position)=0
Function to inject mouse wheel changes to GUIContexts.
int d_appWindowWidth
Int defining the application window's width.
Definition: SamplesFrameworkBase.h:213
virtual void cleanup()
Cleans up all resources allocated by the initialise call.
Definition: SamplesFrameworkBase.cpp:284
virtual bool injectKeyUp(const CEGUI::Key::Scan &ceguiKey)=0
Function to inject key up to GUIContexts.
bool d_quitting
Bool defining if application should quit.
Definition: SamplesFrameworkBase.h:211
virtual void deinitialise()=0
deinitialise the resources allocated in the initialise if needed.
int run()
Application entry point.
Definition: SamplesFrameworkBase.cpp:122
This is a base class that is intended to be used for all sample applications. Here we take care of co...
Definition: SamplesFrameworkBase.h:42
Base application abstract base class.
Definition: CEGuiBaseApplication.h:67
virtual bool injectMouseButtonUp(const CEGUI::MouseButton &ceguiMouseButton)=0
Function to inject mouse button up to GUIContexts.
void setApplicationWindowSize(int width, int height)
Function setting the application window's size.
Definition: SamplesFrameworkBase.cpp:322
virtual bool injectMousePosition(float x, float y)=0
Function to inject the mouse position to GUIContexts.
virtual bool runApplication()
Initialises the sample system, this includes asking the user for a render to use and the subsequent c...
Definition: SamplesFrameworkBase.cpp:153
CEGuiRendererSelector * d_rendererSelector
Points to the renderer selector object.
Definition: SamplesFrameworkBase.h:208
int d_appWindowHeight
Int defining the application window's height.
Definition: SamplesFrameworkBase.h:214
virtual bool injectMouseButtonDown(const CEGUI::MouseButton &ceguiMouseButton)=0
Function to inject mouse button down to GUIContexts.
virtual bool initialise()=0
Sample specific initialisation goes here. This method is called by the application base object create...
SamplesFrameworkBase()
Constructor.
Definition: SamplesFrameworkBase.cpp:91
virtual bool injectKeyDown(const CEGUI::Key::Scan &ceguiKey)=0
Function to inject key down to GUIContexts.
virtual void handleNewWindowSize(float width, float height)=0
Update function for window size changes.
virtual void renderGUIContexts()=0
Draw function to draw GUIContexts.
CEGuiBaseApplication * d_baseApp
Pointer to the base application object.
Definition: SamplesFrameworkBase.h:209