-
Notifications
You must be signed in to change notification settings - Fork 0
/
Events.cpp
40 lines (37 loc) · 1.12 KB
/
Events.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
#include "Main.h"
#include "Events.h"
Events::Events(std::shared_ptr<sf::RenderWindow> window,
std::shared_ptr<std::vector<Spieler>> spieler,
std::shared_ptr<std::vector<Besucher>> besucher)
{
mWindow = window;
mSpieler = spieler;
mBesucher = besucher;
}
void Events::handleEvents(int winner)
{
sf::Event event;
while (mWindow->pollEvent(event)) {
switch (event.type) {
case sf::Event::Closed:
mWindow->close();
break;
case sf::Event::JoystickButtonPressed:
if(winner >= 0 && event.joystickButton.button <= 3)
mWindow->close();
break;
case sf::Event::KeyPressed:
switch (event.key.code) {
case sf::Keyboard::Return:
if(winner < 0)
break;
case sf::Keyboard::Escape:
mWindow->close();
break;
default: break;
}
break;
default: break;
}
}
}