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
        // Alright, fonts and images! You'll learn more about these in GameApp.cpp
35
        // so check there for more info. 
36
        class ImageFont;
37
        class Image;
38
 
39
class GameApp : public SexyAppBase
40
{
41
 
42
        private:
43
 
44
                Board*          mBoard;
45
 
46
        public:
47
 
48
                // These are the fonts and images we'll be using for this demo. See
49
                // GameApp.cpp for full information on fonts and images. We're going to
50
                // make them public for easy accessing, since the point of this tutorial
51
                // is to quickly get you up to speed on using the framework.
52
                ImageFont*      mTextFont;
53
                ImageFont*      mNumberFont;
54
                Image*          mOpaqueBeamImg;
55
                Image*          mMoonImg;
56
                Image*          mTurbotImg;
57
 
58
 
59
        public:
60
 
61
                GameApp();
62
                virtual ~GameApp();
63
 
64
                //////////////////////////////////////////////////////////////////////////
65
                //      Function: Init
66
                //      Parameters: none
67
                //      Returns: none
68
                //
69
                //      Purpose: Initializes the application. Sets the resolution, overrides
70
                //      any default settings, and if there is a loader/intro screen (not in this demo)
71
                //      creates it and displays it. The framework will then automatically
72
                //      call the LoadingThreadProc() method after this method returns.
73
                //////////////////////////////////////////////////////////////////////////              
74
                virtual void    Init();
75
 
76
                //////////////////////////////////////////////////////////////////////////
77
                //      Function: LoadingThreadProc
78
                //      Parameters: none
79
                //      Returns: none
80
                //
81
                //      Purpose: Loads all resources in a separate thread. If there is a 
82
                //      loader/intro screen (not in this demo), would also update the
83
                //      loader progress indicator. When the function returns, the
84
                //      LoadingThreadCompleted() method is automatically called.
85
                //////////////////////////////////////////////////////////////////////////              
86
                virtual void    LoadingThreadProc();
87
 
88
                //////////////////////////////////////////////////////////////////////////
89
                //      Function: LoadingThreadCompleted
90
                //      Parameters: none
91
                //      Returns: none
92
                //
93
                //      Purpose: Called when LoadingThreadProc is complete and all resources
94
                //      have been loaded. It is in this function that you would then set up
95
                //      your main menu or similar screen. For this particular demo however,
96
                //      we will go straight to the main game class, "Board".
97
                //////////////////////////////////////////////////////////////////////////              
98
                virtual void    LoadingThreadCompleted();
99
 
100
};
101
 
102
}
103
 
104
 
105
#endif  // __GAMEAPP_H__