blob: 83db070f8cec6384f69643536ead5f7cbd5aa9e4 (
plain)
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
|
#ifndef __JIN_EVENT_H
#define __JIN_EVENT_H
#include "../modules.h"
#if JIN_MODULES_INPUT
namespace jin
{
namespace input
{
#if JIN_INPUT_SDL
#include "SDL.h"
typedef SDL_Event Event;
typedef SDL_Keycode Key;
typedef SDL_MouseWheelEvent Wheel;
enum EventType {
QUIT = SDL_QUIT,
KEYDOWN = SDL_KEYDOWN,
KEYUP = SDL_KEYUP,
MOUSEMOTION = SDL_MOUSEMOTION,
MOUSEBUTTONDOWN = SDL_MOUSEBUTTONDOWN,
MOUSEBUTTONUP = SDL_MOUSEBUTTONUP,
MOUSEWHEEL = SDL_MOUSEWHEEL
};
inline int pollEvent(Event* e)
{
return SDL_PollEvent(e);
}
inline const char* getKeyName(Key key)
{
return SDL_GetKeyName(key);
}
inline const char* getButtonName(int button)
{
switch (button)
{
case 1: return "left";
case 2: return "middle";
case 3: return "right";
case 4: return "wheelup";
case 5: return "wheeldown";
default: return "?";
}
}
/*
inline const char* getWheelName(Wheel wheel)
{
if (wheel.x == -1)
return "left";
else if (wheel.x == 1)
return "right";
else if (wheel.y == -1)
return "near";
else if (wheel.y == 1)
return "far";
else
return "none";
}
*/
#endif // JIN_INPUT_SDL
}
}
#endif // JIN_MODULES_INPUT
#endif
|