-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame.cpp
executable file
·81 lines (60 loc) · 1.21 KB
/
Game.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
70
71
72
73
74
75
76
77
78
79
80
81
#include "Game.h"
Game::Game(void)
{
renderManager = new RenderManager();
level = new Level( renderManager );
}
Game::~Game(void)
{
delete renderManager;
delete level;
delete player;
}
void Game::load()
{
renderManager->load();
soundMgr.init();
soundMgr.loadSound();
level->load();
//testing
loadLevel();
}
void Game::tick( InputHandler input, long dt )
{
if( input.keys[ SDLK_UP ] )
{
SDL_Event e;
e.type = SDL_QUIT;
SDL_PushEvent( &e );
// set menu pause...
}
level->tick( dt );
player->tick( dt );
soundMgr.tick();
}
void Game::render()
{
glClear( GL_COLOR_BUFFER_BIT );
glClearColor( ( rand() % 11 ) / 10, ( rand() % 11 ) / 10, ( rand() % 11 ) / 10, 1.0 );
level->render();
/*
int a = 0;
if( r <= 180 && r > 0 ) a = abs( r + 180 );
else if( r > 180 && r < 360 ) a = abs( r - 180 );
if( r >= 360 )
{
r = 0;
}
std::cout << "r: " << r << '\n';
std::cout << "a: " << a << '\n';
r++;*/
}
void Game::setMenu()
{
// at pause set level dead if quit... AT PAUSEMENU-CLASS! NO HEAREH! PAUSE MENU REFERENCE TO GAME;
}
void Game::loadLevel()
{
player = new Player(999);
level->loadLevel( player );
}