Subversion Repositories AndroidProjects

Rev

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
        // We're going to be responsible for creating and adding the title screen widget
35
        class TitleScreen;
36
 
37
class GameApp : public SexyAppBase
38
{
39
 
40
        private:
41
 
42
                Board*                  mBoard;
43
                TitleScreen*    mTitleScreen;
44
 
45
        public:
46
 
47
                GameApp();
48
                virtual ~GameApp();
49
 
50
                //////////////////////////////////////////////////////////////////////////
51
                //      Function: Init
52
                //      Parameters: none
53
                //      Returns: none
54
                //
55
                //      Purpose: Initializes the application. Sets the resolution, overrides
56
                //      any default settings, and if there is a loader/intro screen (not in this demo)
57
                //      creates it and displays it. The framework will then automatically
58
                //      call the LoadingThreadProc() method after this method returns.
59
                //////////////////////////////////////////////////////////////////////////              
60
                virtual void    Init();
61
 
62
                //////////////////////////////////////////////////////////////////////////
63
                //      Function: LoadingThreadProc
64
                //      Parameters: none
65
                //      Returns: none
66
                //
67
                //      Purpose: Loads all resources in a separate thread. If there is a 
68
                //      loader/intro screen (not in this demo), would also update the
69
                //      loader progress indicator. When the function returns, the
70
                //      LoadingThreadCompleted() method is automatically called.
71
                //////////////////////////////////////////////////////////////////////////              
72
                virtual void    LoadingThreadProc();
73
 
74
                //////////////////////////////////////////////////////////////////////////
75
                //      Function: LoadingThreadCompleted
76
                //      Parameters: none
77
                //      Returns: none
78
                //
79
                //      Purpose: Called when LoadingThreadProc is complete and all resources
80
                //      have been loaded. It is in this function that you would then set up
81
                //      your main menu or similar screen. For this particular demo however,
82
                //      we will go straight to the main game class, "Board".
83
                //////////////////////////////////////////////////////////////////////////              
84
                virtual void    LoadingThreadCompleted();              
85
 
86
                //////////////////////////////////////////////////////////////////////////
87
                //      Function: TitleScreenIsFinished
88
                //      Parameters: none
89
                //      Returns: none
90
                //
91
                //      Purpose: Called by the TitleScreen widget when it is about to close
92
                //      down, this indicates that we should now add the board widget and
93
                //      start the game.
94
                //////////////////////////////////////////////////////////////////////////
95
                void    TitleScreenIsFinished();
96
 
97
                //////////////////////////////////////////////////////////////////////////
98
                //      Function: HandleCmdLineParam
99
                //      Parameters:
100
                //              theParamName    - The name of the parameter, will be of the form
101
                //                                                      "-paramname". Note the "-" prefix.
102
                //              theParamValue   - The parameter associated with the param name,
103
                //                                                      or "" if none. 
104
                //
105
                //      Returns: none
106
                //
107
                //      Purpose: This function lets you parse command line parameters and
108
                //      their associated values. Command line parameters are of the form:
109
                //              -paramname or -paramname="some value"
110
                //      Example:
111
                //              Demo4.exe -debug -printmsg="A test message" results in:
112
                //              
113
                //              theParamName = "-debug", theParamValue = ""
114
                //              theParamName = "-printmsg", theParamValue = "A test message"
115
                //////////////////////////////////////////////////////////////////////////              
116
                virtual void HandleCmdLineParam(const std::string& theParamName, const std::string& theParamValue);
117
};
118
 
119
}
120
 
121
 
122
#endif  // __GAMEAPP_H__