Crazy Eddie's GUI System  ${CEGUI_VERSION}
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
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 #include "CEGUI/Exceptions.h"
36 
44 {
45 public:
51 
52 
57  virtual ~SamplesFrameworkBase();
58 
66  int run(const CEGUI::String& dataPathPrefixOverride);
67 
76  virtual bool initialise(const CEGUI::String& logFile,
77  const CEGUI::String& dataPathPrefixOverride);
78 
79  virtual void cleanup();
80 
85  virtual void update(float passedTime) = 0;
86 
91  virtual void handleNewWindowSize(float width, float height) = 0;
92 
93  void renderSingleFrame(float elapsed);
94 
99  virtual void renderGUIContexts() = 0;
100 
107  virtual bool injectKeyDown(const CEGUI::Key::Scan& ceguiKey) = 0;
108 
115  virtual bool injectKeyUp(const CEGUI::Key::Scan& ceguiKey) = 0;
116 
123  virtual bool injectChar(int character) = 0;
124 
131  virtual bool injectMouseButtonDown(const CEGUI::MouseButton& ceguiMouseButton) = 0;
132 
139  virtual bool injectMouseButtonUp(const CEGUI::MouseButton& ceguiMouseButton) = 0;
140 
147  virtual bool injectMouseWheelChange(float position) = 0;
148 
155  virtual bool injectMousePosition(float x, float y) = 0;
156 
161  virtual void setQuitting(bool quit);
162 
169  bool isQuitting();
170 
175  void setApplicationWindowSize(int width, int height);
176 
181  void outputExceptionMessage(const char* message);
182 
183 protected:
184 
185  /*************************************************************************
186  Data fields
187  *************************************************************************/
190 
191  bool d_quitting;
192 
195 };
196 
197 #endif // end of guard _SamplesFrameworkBase_h_
Base class for the renderer selection dialog class.
Definition: CEGuiRendererSelector.h:57
bool isQuitting()
Function returning if the application should quit as soon as possible.
Definition: SamplesFrameworkBase.cpp:347
void outputExceptionMessage(const char *message)
Output a message to the user in some OS independant way.
Definition: SamplesFrameworkBase.cpp:327
virtual void setQuitting(bool quit)
Function to set the bool defining if the application should quit as soon as possible.
Definition: SamplesFrameworkBase.cpp:342
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:120
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:193
virtual bool initialise(const CEGUI::String &logFile, const CEGUI::String &dataPathPrefixOverride)
Initialises the sample system, this includes asking the user for a render to use and the subsequent c...
Definition: SamplesFrameworkBase.cpp:166
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:191
This is a base class that is intended to be used for all sample applications. Here we take care of co...
Definition: SamplesFrameworkBase.h:43
int run(const CEGUI::String &dataPathPrefixOverride)
Application entry point.
Definition: SamplesFrameworkBase.cpp:138
Base application abstract base class.
Definition: CEGuiBaseApplication.h:69
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:352
virtual bool injectMousePosition(float x, float y)=0
Function to inject the mouse position to GUIContexts.
CEGuiRendererSelector * d_rendererSelector
Points to the renderer selector object.
Definition: SamplesFrameworkBase.h:188
int d_appWindowHeight
Int defining the application window's height.
Definition: SamplesFrameworkBase.h:194
virtual bool injectMouseButtonDown(const CEGUI::MouseButton &ceguiMouseButton)=0
Function to inject mouse button down to GUIContexts.
SamplesFrameworkBase()
Constructor.
Definition: SamplesFrameworkBase.cpp:108
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:189
String class used within the GUI system.
Definition: cegui/include/CEGUI/String.h:62