2 * Copyright 2020 Iwo 'Outfrost' Bujkiewicz
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 #include <GLFW/glfw3.h>
13 #include "engine/_prelude.h"
17 void keyboardInput(int key, int scancode UNUSED, int action, int mods UNUSED) {
20 if (action == GLFW_PRESS) {
21 startMovement(DIRECTION_UP);
23 else if (action == GLFW_RELEASE) {
24 stopMovement(DIRECTION_UP);
28 if (action == GLFW_PRESS) {
29 startMovement(DIRECTION_DOWN);
31 else if (action == GLFW_RELEASE) {
32 stopMovement(DIRECTION_DOWN);
36 if (action == GLFW_PRESS) {
37 startMovement(DIRECTION_LEFT);
39 else if (action == GLFW_RELEASE) {
40 stopMovement(DIRECTION_LEFT);
44 if (action == GLFW_PRESS) {
45 startMovement(DIRECTION_RIGHT);
47 else if (action == GLFW_RELEASE) {
48 stopMovement(DIRECTION_RIGHT);