-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathglfw3inputbackend.cpp
More file actions
110 lines (90 loc) · 2.71 KB
/
glfw3inputbackend.cpp
File metadata and controls
110 lines (90 loc) · 2.71 KB
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
#include <fea/ui/glfw3inputbackend.hpp>
namespace fea
{
GLFW3InputBackend::GLFW3InputBackend():
mKeyRepeat(true)
{
}
std::queue<Event> GLFW3InputBackend::fetchEvents()
{
std::queue<Event> result;
glfwSetKeyCallback(window, key_callback);
void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
switch(action){
case GLFW_PRESS:
switch(key)
{
case GLFW_KEY_E:
KeyEvent event;
Code code(4);
event = key_press(code,false,false,false,false);
break;
case GLFW_KEY_A:
KeyEvent event;
Code code(0);
event = key_press(code,false,false,false,false);
break;
case GLFW_KEY_B:
KeyEvent event;
Code code(1);
event = key_press(code,false,false,false,false);
break;
}
break;
}
}
}
return event;
}
bool GLFW3InputBackend::isKeyPressed(Keyboard::Code code)
{
return false;
}
bool GLFW3InputBackend::isMouseButtonPressed(Mouse::Button b)
{
return false;
}
Vec2I GLFW3InputBackend::getMouseGlobalPosition()
{
return {};
}
Vec2I GLFW3InputBackend::getMouseWindowPosition()
{
return {};
}
void GLFW3InputBackend::setMouseGlobalPosition(int32_t x, int32_t y)
{
}
void GLFW3InputBackend::setMouseWindowPosition(int32_t x, int32_t y)
{
}
bool GLFW3InputBackend::isGamepadConnected(uint32_t id)
{
return true;
}
uint32_t GLFW3InputBackend::getGamepadButtonCount(uint32_t id)
{
return 0;
}
bool GLFW3InputBackend::isGamepadButtonPressed(uint32_t id, uint32_t button)
{
return false;
}
bool GLFW3InputBackend::gamepadHasAxis(uint32_t id, Gamepad::Axis axis)
{
return false;
}
float GLFW3InputBackend::getGamepadAxisPosition(uint32_t id, Gamepad::Axis axis)
{
return 0.0f;
}
void GLFW3InputBackend::setGamepadThreshold(float threshold)
{
(void) threshold;
}
void GLFW3InputBackend::setKeyRepeatEnabled(bool enabled)
{
(void) enabled;
}
}