doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GameBustOutWindow.h
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 #ifndef __GAME_BUSTOUT_WINDOW_H__
29 #define __GAME_BUSTOUT_WINDOW_H__
30 
32 
33 typedef enum {
38 
39 class BOEntity {
40 public:
41  bool visible;
42 
45  float width, height;
49 
51 
52  bool removed;
53  bool fadeOut;
54 
56 
57 public:
59  virtual ~BOEntity();
60 
61  virtual void WriteToSaveGame( idFile *savefile );
62  virtual void ReadFromSaveGame( idFile *savefile, idGameBustOutWindow* _game );
63 
64  void SetMaterial(const char* name);
65  void SetSize( float _width, float _height );
66  void SetColor( float r, float g, float b, float a );
67  void SetVisible( bool isVisible );
68 
69  virtual void Update( float timeslice, int guiTime );
70  virtual void Draw(idDeviceContext *dc);
71 
72 private:
73 };
74 
75 typedef enum {
81 } collideDir_t;
82 
83 class BOBrick {
84 public:
85  float x;
86  float y;
87  float width;
88  float height;
90 
91  bool isBroken;
92 
94 
95 public:
96  BOBrick();
97  BOBrick( BOEntity *_ent, float _x, float _y, float _width, float _height );
98  ~BOBrick();
99 
100  virtual void WriteToSaveGame( idFile *savefile );
101  virtual void ReadFromSaveGame( idFile *savefile, idGameBustOutWindow *game );
102 
103  void SetColor( idVec4 bcolor );
105 
106 private:
107 };
108 
109 #define BOARD_ROWS 12
110 
112 public:
116 
117  virtual void WriteToSaveGame( idFile *savefile );
118  virtual void ReadFromSaveGame( idFile *savefile );
119 
120  virtual const char* HandleEvent(const sysEvent_t *event, bool *updateVisuals);
121  virtual void PostParse();
122  virtual void Draw(int time, float x, float y);
123  virtual const char* Activate(bool activate);
124  virtual idWinVar * GetWinVarByName (const char *_name, bool winLookup = false, drawWin_t** owner = NULL);
125 
127 
128 private:
129  void CommonInit();
130  void ResetGameState();
131 
132  void ClearBoard();
133  void ClearPowerups();
134  void ClearBalls();
135 
136  void LoadBoardFiles();
137  void SetCurrentBoard();
138  void UpdateGame();
139  void UpdatePowerups();
140  void UpdatePaddle();
141  void UpdateBall();
142  void UpdateScore();
143 
145  BOEntity * CreatePowerup( BOBrick *brick );
146 
147  virtual bool ParseInternalVar(const char *name, idParser *src);
148 
149 private:
150 
156 
157  float timeSlice;
158  bool gameOver;
159 
163 
166 
170 
173 
174  float ballSpeed;
178 
181 
184 };
185 
186 #endif //__GAME_BUSTOUT_WINDOW_H__
virtual void ReadFromSaveGame(idFile *savefile, idGameBustOutWindow *game)
GLubyte g
Definition: glext.h:4662
idList< BOBrick * > board[BOARD_ROWS]
virtual const char * Activate(bool activate)
#define BOARD_ROWS
virtual void WriteToSaveGame(idFile *savefile)
virtual void Draw(int time, float x, float y)
virtual ~BOEntity()
GLenum GLint GLint y
Definition: glext.h:2849
virtual void ReadFromSaveGame(idFile *savefile)
virtual bool ParseInternalVar(const char *name, idParser *src)
void SetVisible(bool isVisible)
collideDir_t
GLuint src
Definition: glext.h:5390
idList< BOEntity * > balls
GLenum GLint x
Definition: glext.h:2849
virtual void Draw(idDeviceContext *dc)
void SetColor(idVec4 bcolor)
Definition: File.h:50
virtual void WriteToSaveGame(idFile *savefile)
Definition: Vector.h:52
void SetMaterial(const char *name)
Definition: Vector.h:808
#define NULL
Definition: Lib.h:88
virtual void WriteToSaveGame(idFile *savefile)
powerupType_t powerup
virtual void ReadFromSaveGame(idFile *savefile, idGameBustOutWindow *_game)
idList< BOEntity * > powerUps
GLubyte GLubyte GLubyte a
Definition: glext.h:4662
idList< BOEntity * > entities
const idMaterial * material
GLubyte GLubyte b
Definition: glext.h:4662
collideDir_t checkCollision(idVec2 pos, idVec2 vel)
void SetColor(float r, float g, float b, float a)
idGameBustOutWindow * game
GLdouble GLdouble GLdouble r
Definition: glext.h:2951
powerupType_t powerup
idUserInterfaceLocal * gui
Definition: Window.h:427
void SetSize(float _width, float _height)
unsigned char byte
Definition: Lib.h:75
const GLcharARB * name
Definition: glext.h:3629
Definition: Str.h:116
powerupType_t
idGameBustOutWindow(idUserInterfaceLocal *gui)
BOEntity(idGameBustOutWindow *_game)
BOEntity * ent
idGame * game
Definition: Game_local.cpp:65
virtual idWinVar * GetWinVarByName(const char *_name, bool winLookup=false, drawWin_t **owner=NULL)
BOEntity * CreatePowerup(BOBrick *brick)
idStr materialName
idVec2 position
virtual void Update(float timeslice, int guiTime)
idVec2 velocity
virtual const char * HandleEvent(const sysEvent_t *event, bool *updateVisuals)