Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 244 | chris | 1 | #ifndef __GAMEAPP_H__ |
| 2 | #define __GAMEAPP_H__ |
||
| 3 | |||
| 4 | ////////////////////////////////////////////////////////////////////////// |
||
| 5 | // GameApp.h |
||
| 6 | // |
||
| 7 | // This is what drives the whole game. In here, you derive your class |
||
| 8 | // from SexyAppBase and implement common game tasks, such as |
||
| 9 | // responding to widgets (covered later), initializing and loading |
||
| 10 | // resources, setting up the various game screens, etc. |
||
| 11 | // All applications at minimum must have a class that derives from |
||
| 12 | // SexyAppBase. |
||
| 13 | // |
||
| 14 | // The GameApp class is used to do such things as create the main |
||
| 15 | // menu screen, create the main game class (where all drawing/updating/ |
||
| 16 | // interaction takes place), etc. |
||
| 17 | ////////////////////////////////////////////////////////////////////////// |
||
| 18 | |||
| 19 | #include "SexyAppFramework/SexyAppBase.h" |
||
| 20 | |||
| 21 | // We place all our classes inside the "Sexy" namespace to avoid name collisions |
||
| 22 | // with other libraries that might be added. |
||
| 23 | namespace Sexy |
||
| 24 | { |
||
| 25 | |||
| 26 | // The GameApp class will be responsible for creating a class by the name |
||
| 27 | // of "Board", which we will use to do all the game's drawing, input processing, |
||
| 28 | // etc. Board is the second most important class and is where almost all of your |
||
| 29 | // game logic code will originate from. It is a widget, which allows for |
||
| 30 | // easy and automatic invocation of its update, drawing, and input processing |
||
| 31 | // functions. See the "Board" class for more details. |
||
| 32 | class Board; |
||
| 33 | |||
| 34 | class GameApp : public SexyAppBase |
||
| 35 | { |
||
| 36 | |||
| 37 | private: |
||
| 38 | |||
| 39 | Board* mBoard; |
||
| 40 | |||
| 41 | |||
| 42 | public: |
||
| 43 | |||
| 44 | GameApp(); |
||
| 45 | virtual ~GameApp(); |
||
| 46 | |||
| 47 | ////////////////////////////////////////////////////////////////////////// |
||
| 48 | // Function: Init |
||
| 49 | // Parameters: none |
||
| 50 | // Returns: none |
||
| 51 | // |
||
| 52 | // Purpose: Initializes the application. Sets the resolution, overrides |
||
| 53 | // any default settings, and if there is a loader/intro screen (not in this demo) |
||
| 54 | // creates it and displays it. The framework will then automatically |
||
| 55 | // call the LoadingThreadProc() method after this method returns. |
||
| 56 | ////////////////////////////////////////////////////////////////////////// |
||
| 57 | virtual void Init(); |
||
| 58 | |||
| 59 | ////////////////////////////////////////////////////////////////////////// |
||
| 60 | // Function: LoadingThreadProc |
||
| 61 | // Parameters: none |
||
| 62 | // Returns: none |
||
| 63 | // |
||
| 64 | // Purpose: Loads all resources in a separate thread. If there is a |
||
| 65 | // loader/intro screen (not in this demo), would also update the |
||
| 66 | // loader progress indicator. When the function returns, the |
||
| 67 | // LoadingThreadCompleted() method is automatically called. |
||
| 68 | ////////////////////////////////////////////////////////////////////////// |
||
| 69 | virtual void LoadingThreadProc(); |
||
| 70 | |||
| 71 | ////////////////////////////////////////////////////////////////////////// |
||
| 72 | // Function: LoadingThreadCompleted |
||
| 73 | // Parameters: none |
||
| 74 | // Returns: none |
||
| 75 | // |
||
| 76 | // Purpose: Called when LoadingThreadProc is complete and all resources |
||
| 77 | // have been loaded. It is in this function that you would then set up |
||
| 78 | // your main menu or similar screen. For this particular demo however, |
||
| 79 | // we will go straight to the main game class, "Board". |
||
| 80 | ////////////////////////////////////////////////////////////////////////// |
||
| 81 | virtual void LoadingThreadCompleted(); |
||
| 82 | |||
| 83 | }; |
||
| 84 | |||
| 85 | } |
||
| 86 | |||
| 87 | |||
| 88 | #endif // __GAMEAPP_H__ |