-
Notifications
You must be signed in to change notification settings - Fork 0
/
Event.cpp
115 lines (102 loc) · 2.26 KB
/
Event.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include "Library.h"
Event::Event()
{
}
Event::~Event()
{
//Virtual
}
void Event::OnEvent(SDL_Event* event)
{
switch (event->type)
{
case SDL_KEYDOWN:
{
KeyDown(event->key.keysym.sym);
break;
}
case SDL_KEYUP:
{
KeyUp(event->key.keysym.sym);
break;
}
case SDL_MOUSEMOTION:
{
MouseMove(event->motion.x, event->motion.y, event->motion.xrel, event->motion.yrel,
event->motion.state&SDL_BUTTON(SDL_BUTTON_LEFT), event->motion.state&SDL_BUTTON(SDL_BUTTON_RIGHT));
break;
}
case SDL_MOUSEBUTTONDOWN:
{
switch (event->button.button)
{
case SDL_BUTTON_LEFT:
{
LeftButtonDown(event->button.x, event->button.y);
break;
}
case SDL_BUTTON_RIGHT:
{
RightButtonDown(event->button.x, event->button.y);
break;
}
}
break;
}
case SDL_MOUSEBUTTONUP:
{
switch (event->button.button)
{
case SDL_BUTTON_LEFT:
{
LeftButtonUp(event->button.x, event->button.y);
break;
}
case SDL_BUTTON_RIGHT:
{
RightButtonUp(event->button.x, event->button.y);
break;
}
}
break;
}
case SDL_QUIT:
{
Exit();
break;
}
}
}
void Event::KeyDown(SDL_Keycode key)
{
//Virtual
}
void Event::KeyUp(SDL_Keycode key)
{
//Virtual
}
void Event::MouseMove(const int &mouseX, const int &mouseY, const int &relX, const int &relY,
const bool &left , const bool &right)
{
//Virtual
}
void Event::LeftButtonDown(const int &mouseX, const int &mouseY)
{
//Virtual
}
void Event::LeftButtonUp(const int &mouseX, const int &mouseY)
{
//Virtual
}
void Event::RightButtonDown(const int &mouseX, const int &mouseY)
{
//Virtual
}
void Event::RightButtonUp(const int &mouseX, const int &mouseY)
{
//Virtual
}
void Event::Exit()
{
//Virtual
}