| [6596] | 1 | /*********************************************************************** | 
|---|
 | 2 |     filename:   CEGuiSample.h | 
|---|
 | 3 |     created:    24/9/2004 | 
|---|
 | 4 |     author:     Paul D Turner | 
|---|
 | 5 | *************************************************************************/ | 
|---|
 | 6 | /*************************************************************************** | 
|---|
 | 7 |  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team | 
|---|
 | 8 |  * | 
|---|
 | 9 |  *   Permission is hereby granted, free of charge, to any person obtaining | 
|---|
 | 10 |  *   a copy of this software and associated documentation files (the | 
|---|
 | 11 |  *   "Software"), to deal in the Software without restriction, including | 
|---|
 | 12 |  *   without limitation the rights to use, copy, modify, merge, publish, | 
|---|
 | 13 |  *   distribute, sublicense, and/or sell copies of the Software, and to | 
|---|
 | 14 |  *   permit persons to whom the Software is furnished to do so, subject to | 
|---|
 | 15 |  *   the following conditions: | 
|---|
 | 16 |  * | 
|---|
 | 17 |  *   The above copyright notice and this permission notice shall be | 
|---|
 | 18 |  *   included in all copies or substantial portions of the Software. | 
|---|
 | 19 |  * | 
|---|
 | 20 |  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | 
|---|
 | 21 |  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | 
|---|
 | 22 |  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | 
|---|
 | 23 |  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR | 
|---|
 | 24 |  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | 
|---|
 | 25 |  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | 
|---|
 | 26 |  *   OTHER DEALINGS IN THE SOFTWARE. | 
|---|
 | 27 |  ***************************************************************************/ | 
|---|
 | 28 | #ifndef _CEGuiSample_h_ | 
|---|
 | 29 | #define _CEGuiSample_h_ | 
|---|
 | 30 |  | 
|---|
 | 31 | #if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined (CEGUI_STATIC) | 
|---|
 | 32 | #   ifdef CEGUISAMPLE_EXPORTS | 
|---|
 | 33 | #       define CEGUISAMPLE_API __declspec(dllexport) | 
|---|
 | 34 | #   else | 
|---|
 | 35 | #       define CEGUISAMPLE_API __declspec(dllimport) | 
|---|
 | 36 | #   endif | 
|---|
 | 37 | #else | 
|---|
 | 38 | #       define CEGUISAMPLE_API | 
|---|
 | 39 | #endif | 
|---|
 | 40 |  | 
|---|
 | 41 |  | 
|---|
 | 42 | // forward declarations | 
|---|
 | 43 | class CEGuiBaseApplication; | 
|---|
 | 44 | class CEGuiRendererSelector; | 
|---|
 | 45 |  | 
|---|
 | 46 |  | 
|---|
 | 47 | /*! | 
|---|
 | 48 | \brief | 
|---|
 | 49 |     This is a base class that is intended to be used for all sample applications. | 
|---|
 | 50 |     Here we take care of common things such the renderer selection and application | 
|---|
 | 51 |     startup. | 
|---|
 | 52 | */ | 
|---|
 | 53 | class CEGUISAMPLE_API CEGuiSample | 
|---|
 | 54 | { | 
|---|
 | 55 | public: | 
|---|
 | 56 |     /*! | 
|---|
 | 57 |     \brief | 
|---|
 | 58 |         Constructor. | 
|---|
 | 59 |     */ | 
|---|
 | 60 |     CEGuiSample(); | 
|---|
 | 61 |  | 
|---|
 | 62 |  | 
|---|
 | 63 |     /*! | 
|---|
 | 64 |     \brief | 
|---|
 | 65 |         Destructor. | 
|---|
 | 66 |     */ | 
|---|
 | 67 |     virtual ~CEGuiSample(); | 
|---|
 | 68 |  | 
|---|
 | 69 |  | 
|---|
 | 70 |     /*! | 
|---|
 | 71 |     \brief | 
|---|
 | 72 |         Application entry point. | 
|---|
 | 73 |  | 
|---|
 | 74 |     \return | 
|---|
 | 75 |         code to be returned by the application. | 
|---|
 | 76 |     */ | 
|---|
 | 77 |     int run(); | 
|---|
 | 78 |  | 
|---|
 | 79 |  | 
|---|
 | 80 |     /*! | 
|---|
 | 81 |     \brief | 
|---|
 | 82 |         Sample specific initialisation goes here.  This method is called by the application base object created | 
|---|
 | 83 |         as part of the initialise call. | 
|---|
 | 84 |  | 
|---|
 | 85 |     \return | 
|---|
 | 86 |         false if something went wrong. | 
|---|
 | 87 |     */ | 
|---|
 | 88 |     virtual bool initialiseSample()  = 0; | 
|---|
 | 89 |  | 
|---|
 | 90 |  | 
|---|
 | 91 |     /*! | 
|---|
 | 92 |     \brief | 
|---|
 | 93 |         Cleans up resources allocated in the initialiseSample call. | 
|---|
 | 94 |     */ | 
|---|
 | 95 |     virtual void cleanupSample() = 0; | 
|---|
 | 96 |  | 
|---|
 | 97 |  | 
|---|
 | 98 | protected: | 
|---|
 | 99 |     /*! | 
|---|
 | 100 |     \brief | 
|---|
 | 101 |         Initialises the sample system, this includes asking the user for a render to use and | 
|---|
 | 102 |         the subsequent creation of the required systems to support that renderer. | 
|---|
 | 103 |  | 
|---|
 | 104 |     \return | 
|---|
 | 105 |         false if anything went wrong. | 
|---|
 | 106 |     */ | 
|---|
 | 107 |     virtual bool initialise(); | 
|---|
 | 108 |  | 
|---|
 | 109 |  | 
|---|
 | 110 |     /*! | 
|---|
 | 111 |     \brief | 
|---|
 | 112 |         Cleans up all resources allocated by the initialise call. | 
|---|
 | 113 |     */ | 
|---|
 | 114 |     virtual void cleanup(); | 
|---|
 | 115 |  | 
|---|
 | 116 |  | 
|---|
 | 117 |     /*! | 
|---|
 | 118 |     \brief | 
|---|
 | 119 |         Output a message to the user in some OS independant way. | 
|---|
 | 120 |     */ | 
|---|
 | 121 |     void outputExceptionMessage(const char* message) const; | 
|---|
 | 122 |  | 
|---|
 | 123 |     /************************************************************************* | 
|---|
 | 124 |         Data fields | 
|---|
 | 125 |     *************************************************************************/ | 
|---|
 | 126 |     CEGuiRendererSelector*  d_rendererSelector;     //!< Points to the renderer selector object. | 
|---|
 | 127 |     CEGuiBaseApplication*   d_sampleApp;            //!< Pointer to the base application object. | 
|---|
 | 128 | }; | 
|---|
 | 129 |  | 
|---|
 | 130 | #endif  // end of guard _CEGuiSample_h_ | 
|---|