summary refs log tree commit diff stats
path: root/mazeoflife.cpp
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2009-11-08 13:42:14 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2009-11-08 13:42:14 -0500
commitba90715d26e84fd176a0d44bd8e5dde826067d93 (patch)
treea5f0ca481895197f1d0e5db341e7263e3fcc0529 /mazeoflife.cpp
parentc027f1b9cd6c9deb60931a7f9f75bb4ee130291b (diff)
downloadmazeoflife-ba90715d26e84fd176a0d44bd8e5dde826067d93.tar.gz
mazeoflife-ba90715d26e84fd176a0d44bd8e5dde826067d93.tar.bz2
mazeoflife-ba90715d26e84fd176a0d44bd8e5dde826067d93.zip
Added global highscore list
You can now view and submit highscores to the global highscore list. If the connection fails, you are allowed to retry sending it so your score is not
lost. The actual global highscore list is a PHP file and MySQL database that will need to be uploaded to Four Island Other for this to work.

Some other things were done. Because it was discovered that the frequent window caption changes were making Maze Of Life crash, they were removed and the
player is now notified of their score by the level number appearing in 100 point font at the beginning of each level during the doneWorking stage. Also,
a cheat was added that allows you to play the game in fullscreen if you press F4 on a supporting platform. The player is now also slightly faster.

Closes #104
Diffstat (limited to 'mazeoflife.cpp')
-rw-r--r--mazeoflife.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/mazeoflife.cpp b/mazeoflife.cpp index c744b28..45fc377 100644 --- a/mazeoflife.cpp +++ b/mazeoflife.cpp
@@ -19,9 +19,16 @@ int main(int argc, char *argv[])
19 exit(-1); 19 exit(-1);
20 } 20 }
21 21
22 if (SDLNet_Init() == -1)
23 {
24 printf("Cound not initalize SDL_net: %s.\n", SDLNet_GetError());
25 exit(-1);
26 }
27
22 /* Clean up on exit */ 28 /* Clean up on exit */
23 atexit(SDL_Quit); 29 atexit(SDL_Quit);
24 atexit(TTF_Quit); 30 atexit(TTF_Quit);
31 atexit(SDLNet_Quit);
25 32
26 SDL_WM_SetCaption("Maze Of Life", NULL); 33 SDL_WM_SetCaption("Maze Of Life", NULL);
27 34
@@ -39,7 +46,7 @@ int main(int argc, char *argv[])
39 exit(1); 46 exit(1);
40 } 47 }
41 48
42 SDL_EnableKeyRepeat(100, 50); 49 SDL_EnableKeyRepeat(100, 70);
43 50
44 state = new TitleState(); 51 state = new TitleState();
45 52
@@ -57,15 +64,16 @@ int main(int argc, char *argv[])
57 64
58 break; 65 break;
59 case SDL_KEYDOWN: 66 case SDL_KEYDOWN:
60 state->input(anEvent.key.keysym); 67 if (anEvent.key.keysym.sym == SDLK_F4)
68 {
69 SDL_WM_ToggleFullScreen(screen);
70 } else {
71 state->input(anEvent.key.keysym);
72 }
61 73
62 break; 74 break;
63 } 75 }
64 } 76 }
65
66 state->render(screen);
67
68 SDL_Flip(screen);
69 } 77 }
70 78
71 exit(0); 79 exit(0);
@@ -101,6 +109,9 @@ void changeState(State* nState)
101Uint32 tick(Uint32 interval, void *param) 109Uint32 tick(Uint32 interval, void *param)
102{ 110{
103 state->tick(); 111 state->tick();
112 state->render(screen);
113
114 SDL_Flip(screen);
104 115
105 return interval; 116 return interval;
106} 117}