mElite  1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
App.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 // global includes
9 #include "OpenGLApplication.h"// base class
10 #include <vector>
11 #include <string>
12 
13 // Forward declarations of classes
14 class TextureLoader;
15 class CameraObject;
16 class PlayerObject;
17 class BitmapFont;
18 class TextureFont;
19 class TextInput;
20 class Console;
21 class MouseHandler;
22 class Frustum;
23 class HudLoadBar;
24 class Button;
25 
38 private:
39  GLuint g_dynamicTextureID;
40 
41 private:
42  static consoleCommand table[];
43 public:
44  bool initialize( void );// perform initialization, executed when toggling to fullscreen
45  void deinitialize( void );// perform all deinitialization
46  void update( DWORD milliseconds ); // perform motion updates and get user inputs
47  void draw( void ); // draw the scene
48 private:
49  // initialization
50  void initializeObjects( void );// loads and initializes all used game models
51  void initMarketplace( void ); // initializes the marketplace
52  void initializeGFX( void ); // initializes graphics
53  // some private draw functions
54  void drawCurrentSystem();
55  void drawHelp();
56  void drawHelpEnvironment();
57  void drawHelpInfo();
58  void drawHelpLocal();
59  void drawHelpMarketplace();
60  void drawLocalSystems();
61  void drawMarketplace();
62  void drawSystemInfo();
63  void drawGameOver();
64  // some private update functions
65  void stationWasHit();
66  void updateCurrentSystem( DWORD deltaTime );
67  void updateLocalSystems( DWORD deltaTime );
68  void updateSystemInfo( DWORD deltaTime );
69  // some private input handling functions
70  void performConsoleInput(); // handles input for the console
71  void performCurrentSystemInput( DWORD deltaTime );// handles input for current system screen
72  void performLocalSystemsInput( DWORD deltaTime ); // handles input for local systems screen
73  void performSystemInfoInput( DWORD deltaTime ); // handles input for system info screen
74 public:
75  GLUquadricObj *getQuadricObject() { return quadObj; }
76 private:
77  bool gameOver;
78  bool firstDraw;
79  TextureLoader * loader;
80 private:
81  // constructors and destructors
82  friend class OpenGLApplication;
83  App( const char * className ); // Class Constructor
84  ~App();
85 
86  // the screen that is to be drawn
87  Screens currentScreen;
88  void setScreen( Screens screen );
89 private:
90  bool inStation;
91 
92 public:
93  // general initialization
94  void loadAllNeededTextures();
95  void loadSystemTextures();
96 
97  // objects used for games
98  MouseHandler *mouse;// gives a mouse object used for mouse-handling
100  CameraObject *cameraSystemView;// the camera that sees the system in system information screen
101  BitmapFont * bf;// automatic generated bitmap font, used for startup screen
102  TextureFont * tf;// texture font 1
103  TextureFont * tf2;// texture font 2
104  TextInput *ti; // input class, used for giving commands
105  Console *con;// console
106  Frustum *frustum;// frustum, used for culling of hidden objects
107 
108 public:
109  // some functions to get the objects
110  Frustum * getFrustum( void );
111 private:
112  // the quadric object that is used for the skysphere
113  GLUquadricObj *quadObj;
114 
115  // internal status
116  bool m_inputmode;
117  GLfloat lightspeed;
118  bool devmode;
119  float handlingSpeedMultiplyer; // allows faster movement of the camera
120 
121  // game status
122  bool laserActive;
123 
124  // information output
125 public:
126  void printInfoLine( const char *text, ... ); // print info line
127 private:
128  void printInfoBox( bool clear );
129  std::vector<std::string> infoBoxLines;
130  bool m_showFrameRate;
131  bool m_showFrameTime;
132  bool m_showSpeed;
133  bool m_showResolution;
134  unsigned int infoOutputLine;
135  bool m_switchColors;
136 
137  // debug status vars
138  int currentSystemInfoNumber;
139 
140  // system info status
141  GLfloat systemInfoViewAngle;
142  GLfloat systemInfoViewAngle2;
143  GLfloat zoomFactor;
144 
145  // functions to change status with console
146  void showFrameRate();
147  void showFrameTime();
148  void showSpeed();
149  void showResolution();
150  void showHelp();
151  void devMode();
152  void switchColors();
153 
154  // function pointer array for use with console commands
155  void (App::*fptr[10])( void );
156 
157 private:
158  // help functions
159  void setProjectionOrthogonal( void );
160  void restoreProjection( void );
161 
162  // stuff for the hud and information elements
163  HudLoadBar * speedBar;
164  HudLoadBar * laserHeatBar;
165 
166  // buttons for marketplace screen
167  std::vector<Button*> mktbuttons; // buttons that represent the tradegoods
168  Button * buybutton;// button for buying
169  Button * sellbutton; // button for selling
170  int chosenButton;// saves the chosen button to avoid that two buttons are in status clicked
171 };