-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGame.cpp
More file actions
74 lines (54 loc) · 1.2 KB
/
Game.cpp
File metadata and controls
74 lines (54 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#include <string>
#include <vector>
#include "sdlhelper/SDL_load.h"
#include "Sprite.h"
#include "Entity.h"
const int screenWidth = 800;
const int screenHeight = 600;
const int screenBPP = 32;
const char* title = "Galaxian Clone";
class Game {
public:
//the window
SDL_Surface* screen;
//event structure
SDL_Event eventQueue;
//game entities here:
Entity* ship;
//lists
std::vector<Entity*> entityList;
std::vector<Entity*> removeList;
//functions
bool initWindow();
bool initEntities();
Game();
};
bool Game::initWindow() {
screen = NULL;
//Initialize all SDL subsystems
if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 ) {
return false;
}
//Set up the screen
screen = SDL_SetVideoMode(screenWidth, screenHeight, screenBPP, SDL_SWSURFACE);
//If there was an error in setting up the screen
if( screen == NULL ) {
return false;
}
//Set the window caption
SDL_WM_SetCaption( title, NULL );
//If everything initialized fine
return true;
}
bool Game::initEntities() {
}
Game::Game() {
//initialize window
initWindow(); //to-do: exception-handling
//initialize objects
initEntities(); //to-do: exception-handling
}
int main() {
Game g = Game();
//g.startLoop();
}