-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOmega.cpp
64 lines (48 loc) · 1.42 KB
/
Omega.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
#include "Omega.h"
#undef main
void fSDLPrintError(char* strMessage) {
printf("%s Error : %s\n", strMessage, SDL_GetError());
}
appOmega::appOmega() {
bRunning = true;
windowFlags = 0;
}
void appOmega::fToggleFullscreen() {
Uint32 flags = (SDL_GetWindowFlags(displayWindow) ^ SDL_WINDOW_FULLSCREEN_DESKTOP);
if (SDL_SetWindowFullscreen(displayWindow, flags) < 0) {
std::cout << "Toggling fullscreen mode failed: " << SDL_GetError() << std::endl;
}
if ((flags & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
displayCamera.bFullscreen = true;
SDL_DisplayMode currentDisplay;
SDL_GetCurrentDisplayMode(0, ¤tDisplay);
displayCamera.dstRect = { 0, 0, currentDisplay.w, currentDisplay.h };
displayCamera.srcRect = { 0, 0, currentDisplay.w, currentDisplay.h };
}
else {
displayCamera.bFullscreen = false;
displayCamera.dstRect = { 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT };
displayCamera.srcRect = { 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT };
}
}
int appOmega::OnExecute() {
if(OnInit() == false) {
return -1;
}
SDL_Event Event;
while(bRunning) {
systemTimer.getTick();
while(SDL_PollEvent(&Event)) {
OnEvent(&Event);
}
OnLoop();
OnRender();
systemTimer.setDelay();
}
OnCleanup();
return 0;
}
int main(int argc, char* argv[]) {
appOmega theApp;
return theApp.OnExecute();
}