-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
54 lines (40 loc) · 1.15 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
#include <iostream>
#include <vector>
#include "generic/window.h"
#include "generic/input.h"
#ifdef _WIN32
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#endif
using namespace std;
discobreak::GRAPHICS g = discobreak::GRAPHICS::OPENGL;
int main() {
#ifdef _WIN32
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
cout << "Hello, World!" << endl;
discobreak::Window win("Titel", g);
win.GetGraphics()->PrintVersion();
float fixms = 32;
bool debugUpdate = false;
win.SetUpdateCallback([&](float ms)->void {
if(discobreak::Input::IsKeyPressed('E'))
debugUpdate = true;
else if(discobreak::Input::IsKeyPressed('R'))
debugUpdate = false;
if(discobreak::Input::IsKeyPressed('W'))
fixms *= 1.2f;
else if(discobreak::Input::IsKeyPressed('S'))
fixms /= 1.2f;
if (discobreak::Input::IsKeyDown('X'))
exit(0);
if(debugUpdate)
ms = fixms;
});
win.SetDrawCallback([&](float ms)->void {
win.GetGraphics()->Swap();
});
win.Run();
return 0;
}