-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathg_engine.cpp
More file actions
68 lines (51 loc) · 959 Bytes
/
g_engine.cpp
File metadata and controls
68 lines (51 loc) · 959 Bytes
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
#include "g_engine.h"
int g_engine::init()
{
this->self = new Player();
this->map = new GameMap();
if(SDL_Init( SDL_INIT_EVERYTHING ) == -1)
{
cout << "SDL Failed to initialize...\n";
return -1;
}
if( TTF_Init() == -1 )
{
return -1;
}
//Sets window caption
SDL_WM_SetCaption( "Eight Minions", NULL );
//create screen, params are width in pixels, height in pixels, bpp, and flags
screen = SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT,32,SDL_DOUBLEBUF | SDL_HWSURFACE); //end flag was just SDL_SWSURFACE
//INITIATE SDL
}
int g_engine::run()
{
init();
running = true;
while(running)
{
//handle input
//display images
//regulate FPS
//FOR TEST
running = false;
//END TEST
}
return 0;
}
void g_engine::handleInput()
{
while( SDL_PollEvent( &event ) )
{
if(event.type == SDL_QUIT)
{
running = 0;
}
}
}
void g_engine::display()
{
map->display(screen);
self->display(screen);
SDL_flip(screen);
}