summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorLuke Bratch <l_bratch@yahoo.co.uk>2010-11-25 15:04:54 +0000
committerLuke Bratch <l_bratch@yahoo.co.uk>2010-11-25 15:04:54 +0000
commit71926d883a678be983a434f8c0da435178d7585d (patch)
tree0d3598d060ae153aa129eb9eeddeb66f0c48717a /main.cpp
parent3383e8be9001826bf0d09f1fb73ad5013cc8627e (diff)
Add Screen class, move video output functionality to it
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/main.cpp b/main.cpp
index c2b91fe..55db293 100644
--- a/main.cpp
+++ b/main.cpp
@@ -9,8 +9,6 @@ int main(int argc, char* args[]) {
// Main SDL event structure
SDL_Event event;
- // Ggame window
- SDL_Surface *screen;
// Current level number
int levelNo = 1;
// Main loop continues while true
@@ -18,17 +16,13 @@ int main(int argc, char* args[]) {
// Timer start
Uint32 startTicks = 0;
+ // Game window
+ Screen screen;
+
// Initialise SDL
if (SDL_Init(SDL_INIT_EVERYTHING) == -1)
return 1;
- // Turn on the main screen
- if (!(screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE)))
- return 1;
-
- // Set window title
- SDL_WM_SetCaption("Intense Marcus", NULL);
-
Level level;
level.changeLevel(levelNo);
@@ -50,11 +44,10 @@ int main(int argc, char* args[]) {
level.move();
// Draw level
- level.draw(screen);
+ level.draw(&screen);
// Update screen
- if (SDL_Flip(screen) == -1)
- return 1;
+ screen.flip();
// Set FPS cap to 30
if ((SDL_GetTicks() - startTicks) < 1000 / FPS)