Newer
Older
AlgebraicDataflowArchitectureModel / GameEngine / src / main / java / org / example / KeyInput.java
package org.example;

import static org.lwjgl.glfw.GLFW.*;
public class KeyInput {
    private static KeyInput instance;
    private static long window;

    private KeyInput(long window) {
        KeyInput.window = window;
    }

    public static void init(long window) {
        if (instance == null) {
            instance = new KeyInput(window);
        }
    }

    public static boolean KeyPress(int keyCode) {
        return glfwGetKey(window, keyCode) == GLFW_PRESS;
    }
}