-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.cpp
More file actions
65 lines (50 loc) · 986 Bytes
/
App.cpp
File metadata and controls
65 lines (50 loc) · 986 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
#include "App.h"
App::App()
{
Running = true;
window = NULL;
screenSurface = NULL;
renderer = NULL;
active = false;
}
App::~App()
{
//dtor
}
int App::OnExecute()
{
if (OnInit() == false)
{
return -1;
}
SDL_Event Event;
while (Running)
{
while (SDL_PollEvent(&Event))
{
OnEvent (&Event);
}
OnLoop();
OnRender();
}
OnCleanup();
return 0;
}
void print_SDL_version(char* preamble, SDL_version* v) {
SDL_Log("%s %u.%u.%u\n", preamble, v->major, v->minor, v->patch);
}
void print_SDL_versions() {
SDL_version ver;
// Prints the compile time version
SDL_VERSION(&ver);
print_SDL_version("SDL compile-time version", &ver);
// Prints the run-time version
// ver = *SDL_Linked_Version();
// print_SDL_version("SDL runtime version", &ver);
}
int main (int argc, char *argv[])
{
print_SDL_versions();
App theApp;
return theApp.OnExecute();
}