-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
69 lines (64 loc) · 1.57 KB
/
main.cpp
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
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#include "sdlGraphics.h"
#include "menu.h"
#include "game.h"
#include <iostream>
#include <string>
using namespace std;
bool gameRunning = true;
SDLGraphics* g_graphics = NULL;
mainMenu* g_menu = NULL;
game* g_game = NULL;
int main(int argc, char* args[])
{
g_graphics = new SDLGraphics(SCREEN_WIDTH, SCREEN_HEIGHT, WINDOW_TITLE);
g_menu = new mainMenu();
g_game = new game();
while (gameRunning)
{
g_menu->firstLoad();
bool inMenu = true;
int menuStatus;
while (inMenu)
{
menuStatus = g_menu->load();
if (menuStatus == 2)
{
menuStatus = g_menu->loadOptions();
}
if (menuStatus == 1)
{
inMenu = false;
}
if (menuStatus == 0)
{
inMenu = false;
gameRunning = false;
}
}
if (menuStatus != 0)
{
g_menu->menuMusic(false);
int gameStatus = g_game->intro();
cout << "gameStatus is " << gameStatus << endl;
if (gameStatus == 0)
{
gameRunning = false;
return 0;
}
cout << "starting level" << endl;
gameStatus = g_game->level();
if (gameStatus == 0)
{
gameRunning = false;
return 0;
}
}
}
delete g_menu;
delete g_graphics;
return 0;
}