This repository has been archived by the owner on Dec 21, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
87 lines (70 loc) · 2.27 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
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
82
83
84
85
86
87
#include "includes.hpp"
//#include <SDL2/SDL_ttf.h>
using namespace std;
int main(int argc, char** argv) {
SDL& sdl = SDL::init();
sdl.setFPS(60);
sdl.addObject(new Button("images/minus.png", "images/minus.png", sdl.renderer));
((Button*)sdl.getLastObject())->setPos(40, 200);
((Button*)sdl.getLastObject())->bindFunction([&]() {
SDL_Delay(160);
sdl.setCurrentScene(1);
});
sdl.newScene()->addObject(sdl.getLastObject());
sdl.addObject(new Button("images/loupe.png", "images/loupe.png", sdl.renderer));
((Button*)sdl.getLastObject())->setPos(360, 200);
((Button*)sdl.getLastObject())->bindFunction([&]() {
SDL_Delay(160);
sdl.setCurrentScene(1);
});
sdl.getSceneById(0)->addObject(sdl.getLastObject());
sdl.addObject(new Button("images/plus.png", "images/plus.png", sdl.renderer));
((Button*)sdl.getLastObject())->setPos(680, 200);
((Button*)sdl.getLastObject())->bindFunction([&]() {
SDL_Delay(160);
sdl.setCurrentScene(1);
});
sdl.getSceneById(0)->addObject(sdl.getLastObject());
sdl.addObject(new Button("images/noBarcode.png", "images/noBarcode.png", sdl.renderer));
((Button*)sdl.getLastObject())->setPos(200, 200);
((Button*)sdl.getLastObject())->bindFunction([&]() {
SDL_Delay(160);
sdl.setCurrentScene(0);
});
sdl.newScene()->addObject(sdl.getLastObject());
sdl.addObject(new Button("images/typeBarcode.png", "images/typeBarcode.png", sdl.renderer));
((Button*)sdl.getLastObject())->setPos(520, 200);
((Button*)sdl.getLastObject())->bindFunction([&]() {
SDL_Delay(160);
sdl.setCurrentScene(0);
});
sdl.getSceneById(1)->addObject(sdl.getLastObject());
sdl.addObject(new Button("images/cancel.png", "images/cancel.png", sdl.renderer));
((Button*)sdl.getLastObject())->setPos(sdl.windowWidth - 102, 2);
((Button*)sdl.getLastObject())->bindFunction([&]() {
SDL_Delay(160);
sdl.setCurrentScene(0);
});
sdl.getSceneById(1)->addObject(sdl.getLastObject());
sdl.setCurrentScene(0);
for(SDL_Event* event = sdl.eventUpdate(); event->type != SDL_QUIT; sdl.eventUpdate()) {
sdl.inputUpdate(event);
sdl.screenUpdate(event);
//Event handling
switch(event->type) {
case(SDL_MOUSEMOTION): {
break;
}
case(SDL_KEYDOWN): {
break;
}
case(SDL_MOUSEBUTTONDOWN): {
break;
}
default: {
break;
}
}
}
return 0;
}