diff options
Diffstat (limited to 'gfx-app/src')
-rw-r--r-- | gfx-app/src/gfx_app.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/gfx-app/src/gfx_app.c b/gfx-app/src/gfx_app.c index a313ce8..e0211b1 100644 --- a/gfx-app/src/gfx_app.c +++ b/gfx-app/src/gfx_app.c | |||
@@ -138,3 +138,66 @@ cleanup: | |||
138 | void gfx_app_get_mouse_position(double* x, double* y) { | 138 | void gfx_app_get_mouse_position(double* x, double* y) { |
139 | glfwGetCursorPos(g_gfx_app.window, x, y); | 139 | glfwGetCursorPos(g_gfx_app.window, x, y); |
140 | } | 140 | } |
141 | |||
142 | static int to_glfw_key(Key key); | ||
143 | |||
144 | bool gfx_is_key_pressed(Key key) { | ||
145 | return glfwGetKey(g_gfx_app.window, to_glfw_key(key)) == GLFW_PRESS; | ||
146 | } | ||
147 | |||
148 | static int to_glfw_key(Key key) { | ||
149 | switch (key) { | ||
150 | case KeyA: | ||
151 | return GLFW_KEY_A; | ||
152 | case KeyB: | ||
153 | return GLFW_KEY_B; | ||
154 | case KeyC: | ||
155 | return GLFW_KEY_C; | ||
156 | case KeyD: | ||
157 | return GLFW_KEY_D; | ||
158 | case KeyE: | ||
159 | return GLFW_KEY_E; | ||
160 | case KeyF: | ||
161 | return GLFW_KEY_F; | ||
162 | case KeyG: | ||
163 | return GLFW_KEY_G; | ||
164 | case KeyH: | ||
165 | return GLFW_KEY_H; | ||
166 | case KeyI: | ||
167 | return GLFW_KEY_I; | ||
168 | case KeyJ: | ||
169 | return GLFW_KEY_J; | ||
170 | case KeyK: | ||
171 | return GLFW_KEY_K; | ||
172 | case KeyL: | ||
173 | return GLFW_KEY_L; | ||
174 | case KeyM: | ||
175 | return GLFW_KEY_M; | ||
176 | case KeyN: | ||
177 | return GLFW_KEY_N; | ||
178 | case KeyO: | ||
179 | return GLFW_KEY_O; | ||
180 | case KeyP: | ||
181 | return GLFW_KEY_P; | ||
182 | case KeyQ: | ||
183 | return GLFW_KEY_Q; | ||
184 | case KeyR: | ||
185 | return GLFW_KEY_R; | ||
186 | case KeyS: | ||
187 | return GLFW_KEY_S; | ||
188 | case KeyT: | ||
189 | return GLFW_KEY_T; | ||
190 | case KeyU: | ||
191 | return GLFW_KEY_U; | ||
192 | case KeyV: | ||
193 | return GLFW_KEY_V; | ||
194 | case KeyW: | ||
195 | return GLFW_KEY_W; | ||
196 | case KeyX: | ||
197 | return GLFW_KEY_X; | ||
198 | case KeyY: | ||
199 | return GLFW_KEY_Y; | ||
200 | case KeyZ: | ||
201 | return GLFW_KEY_Z; | ||
202 | } | ||
203 | } | ||