#include #include "GL/glew.h" #include "GLFW/glfw3.h" #include "data/Array.h" #include "data/HashMap.h" #include "rendering/Window.h" static GLFWwindow* window = nullptr; static Clock fps; static Clock tps; static IntVector2 size{0, 0}; static bool sizeChanged = false; static List input; static int inputCursor = 0; static int inputLimit = 256; static bool inputActive = false; struct Button final { Window::Controls::ButtonName name; int key; int downTime; int upEvents; int downEvents; int controllerUp; int controllerDown; bool released; Button(const Window::Controls::ButtonName& name) : name(name), key(0), downTime(0), upEvents(0), downEvents(0), controllerUp(0), controllerDown(0), released(false) { } void tick() { bool down = (downEvents > 0) || (controllerDown > 0); bool up = (upEvents == downEvents) && (controllerUp == controllerDown); if(released) { downTime = 0; } downTime += down; released = down && up; downEvents -= upEvents; upEvents = 0; controllerDown -= controllerUp; controllerUp = 0; } }; static Button fallbackButton{"unknown"}; static List