Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 244 | chris | 1 | #ifndef __TITLE_SCREEN_H__ |
| 2 | #define __TITLE_SCREEN_H__ |
||
| 3 | |||
| 4 | #include "SexyAppFramework/Widget.h" |
||
| 5 | #include "SexyAppFramework/ButtonListener.h" |
||
| 6 | |||
| 7 | namespace Sexy |
||
| 8 | { |
||
| 9 | |||
| 10 | class GameApp; |
||
| 11 | class Graphics; |
||
| 12 | class WidgetManager; |
||
| 13 | |||
| 14 | // A new widget that we'll be learning about. It's explained in the .CPP code. |
||
| 15 | class HyperlinkWidget; |
||
| 16 | |||
| 17 | |||
| 18 | // If you forgot about the ButtonListener class, you should review Demo3. |
||
| 19 | // The hyperlink widget is essentially the same thing as a button widget, |
||
| 20 | // and emits the same messages that a button does. Thus, to act on its |
||
| 21 | // messages we derive from the ButtonListener class. |
||
| 22 | class TitleScreen : public Widget, public ButtonListener |
||
| 23 | { |
||
| 24 | |||
| 25 | private: |
||
| 26 | |||
| 27 | GameApp* mApp; |
||
| 28 | HyperlinkWidget* mContinueLink; |
||
| 29 | |||
| 30 | public: |
||
| 31 | |||
| 32 | ////////////////////////////////////////////////////////////////////////// |
||
| 33 | // Function: TitleScreen |
||
| 34 | // Parameters: |
||
| 35 | // theApp - Pointer to the main application class |
||
| 36 | // |
||
| 37 | // Returns: none |
||
| 38 | ////////////////////////////////////////////////////////////////////////// |
||
| 39 | TitleScreen(GameApp* pApp); |
||
| 40 | |||
| 41 | virtual ~TitleScreen(); |
||
| 42 | |||
| 43 | ////////////////////////////////////////////////////////////////////////// |
||
| 44 | // Function: Init |
||
| 45 | // Parameters: none |
||
| 46 | // Returns: none |
||
| 47 | // |
||
| 48 | // Purpose: Called BEFORE the title screen is added to the widget manager |
||
| 49 | // by GameApp. This initializes some things like the images used for |
||
| 50 | // our hyperlink widget. |
||
| 51 | ////////////////////////////////////////////////////////////////////////// |
||
| 52 | void Init(void); |
||
| 53 | |||
| 54 | ////////////////////////////////////////////////////////////////////////// |
||
| 55 | // Function: AddedToManager |
||
| 56 | // Parameters: |
||
| 57 | // theWidgetManager - Pointer to the main widget manager from |
||
| 58 | // GameApp. |
||
| 59 | // |
||
| 60 | // Returns: none |
||
| 61 | // |
||
| 62 | // Purpose: This function is automatically called by the widget manager |
||
| 63 | // which also passes a pointer to itself, when the TitleScreen class is |
||
| 64 | // added to its list of widgets. Every widget gets this function |
||
| 65 | // called when it is first added. It useful to use this function to |
||
| 66 | // set up any other widgets that the class might contain, such as buttons. |
||
| 67 | ////////////////////////////////////////////////////////////////////////// |
||
| 68 | void AddedToManager(WidgetManager* theWidgetManager); |
||
| 69 | |||
| 70 | ////////////////////////////////////////////////////////////////////////// |
||
| 71 | // Function: RemovedFromManager |
||
| 72 | // Parameters: |
||
| 73 | // theWidgetManager - Pointer to the main widget manager from |
||
| 74 | // GameApp. |
||
| 75 | // |
||
| 76 | // Returns: none |
||
| 77 | // |
||
| 78 | // Purpose: This function is automatically called by the widget manager |
||
| 79 | // which also passes a pointer to itself, when the TitleScreen class is |
||
| 80 | // removed from its list of widgets. Every widget gets this function |
||
| 81 | // called when it is finally removed. It useful to use this function to |
||
| 82 | // also remove any widgets that were added and created in AddedToManager. |
||
| 83 | ////////////////////////////////////////////////////////////////////////// |
||
| 84 | void RemovedFromManager(WidgetManager* theWidgetManager); |
||
| 85 | |||
| 86 | ////////////////////////////////////////////////////////////////////////// |
||
| 87 | // Function: ButtonDepress |
||
| 88 | // Parameters: |
||
| 89 | // theId - Integer ID of the button that was clicked |
||
| 90 | // |
||
| 91 | // Returns: none |
||
| 92 | // |
||
| 93 | // Purpose: This method is called by the WidgetManager when a button widget |
||
| 94 | // is first pressed and THEN released. You can use ButtonPress if you want |
||
| 95 | // to know when the button is first pressed (before it is released). |
||
| 96 | // theId is the integer ID that was assigned to the button when it was |
||
| 97 | // first created. |
||
| 98 | ////////////////////////////////////////////////////////////////////////// |
||
| 99 | virtual void ButtonDepress(int theId); |
||
| 100 | |||
| 101 | ////////////////////////////////////////////////////////////////////////// |
||
| 102 | // Function: Draw |
||
| 103 | // Parameters: |
||
| 104 | // g - Graphics object used to draw all images and fonts to the screen. |
||
| 105 | // |
||
| 106 | // Returns: none |
||
| 107 | // |
||
| 108 | // Purpose: Called automatically by GameApp's WidgetManager. This is where |
||
| 109 | // we'll do all our display routines for the loading screen. |
||
| 110 | ////////////////////////////////////////////////////////////////////////// |
||
| 111 | void Draw(Graphics* g); |
||
| 112 | |||
| 113 | ////////////////////////////////////////////////////////////////////////// |
||
| 114 | // Function: LoadingComplete |
||
| 115 | // Parameters: none |
||
| 116 | // Returns: none |
||
| 117 | // |
||
| 118 | // Purpose: Called manually by GameApp when we are done loading all |
||
| 119 | // resources, to let the title screen know that it should unhide and |
||
| 120 | // enable the continue link, so the user can start playing the game. |
||
| 121 | ////////////////////////////////////////////////////////////////////////// |
||
| 122 | void LoadingComplete(); |
||
| 123 | }; |
||
| 124 | |||
| 125 | } |
||
| 126 | |||
| 127 | #endif //__TITLE_SCREEN_H__ |