summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/app.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/app/src/app.c b/app/src/app.c
index 1e636af..9b816ee 100644
--- a/app/src/app.c
+++ b/app/src/app.c
@@ -149,12 +149,30 @@ void gfx_app_get_mouse_position(double* x, double* y) {
149 glfwGetCursorPos(g_gfx_app.window, x, y); 149 glfwGetCursorPos(g_gfx_app.window, x, y);
150} 150}
151 151
152static int to_glfw_mouse_button(MouseButton button);
153
154bool gfx_app_is_mouse_button_pressed(MouseButton button) {
155 return glfwGetMouseButton(g_gfx_app.window, to_glfw_mouse_button(button)) ==
156 GLFW_PRESS;
157}
158
152static int to_glfw_key(Key key); 159static int to_glfw_key(Key key);
153 160
154bool gfx_is_key_pressed(Key key) { 161bool gfx_app_is_key_pressed(Key key) {
155 return glfwGetKey(g_gfx_app.window, to_glfw_key(key)) == GLFW_PRESS; 162 return glfwGetKey(g_gfx_app.window, to_glfw_key(key)) == GLFW_PRESS;
156} 163}
157 164
165static int to_glfw_mouse_button(MouseButton button) {
166 switch (button) {
167 case LMB:
168 return GLFW_MOUSE_BUTTON_LEFT;
169 case RMB:
170 return GLFW_MOUSE_BUTTON_RIGHT;
171 case MMB:
172 return GLFW_MOUSE_BUTTON_MIDDLE;
173 }
174}
175
158static int to_glfw_key(Key key) { 176static int to_glfw_key(Key key) {
159 switch (key) { 177 switch (key) {
160 case KeyA: 178 case KeyA: