Fix maven and flake conf
This commit is contained in:
parent
a07c55cf0f
commit
cb0fa04383
8 changed files with 292 additions and 107 deletions
|
@ -22,8 +22,20 @@ public class Display {
|
|||
|
||||
TITLE = title;
|
||||
displayMode = new DisplayMode(width, height);
|
||||
|
||||
// Configure GLFW for Vulkan
|
||||
glfwDefaultWindowHints();
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); // Tell GLFW not to create an OpenGL context
|
||||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||
glfwWindowHint(GLFW_RESIZABLE, GLFW_TRUE);
|
||||
|
||||
// Create the window
|
||||
window = glfwCreateWindow(displayMode.getWidth(), displayMode.getHeight(), TITLE, NULL, NULL);
|
||||
glfwMakeContextCurrent(window);
|
||||
if (window == NULL)
|
||||
throw new RuntimeException("Failed to create the GLFW window");
|
||||
|
||||
// Make the window visible
|
||||
glfwShowWindow(window);
|
||||
}
|
||||
|
||||
public static void setMouseGrabbed(boolean a) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package fr.mrdev023.vulkan_java.window;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.*;
|
||||
import static org.lwjgl.system.MemoryUtil.NULL;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.*;
|
||||
|
@ -26,16 +27,30 @@ public class Input {
|
|||
private static double ywheel = 0;
|
||||
|
||||
public static void init() {
|
||||
glfwSetScrollCallback(Display.getWindow(), scroll = new GLFWScrollCallback() {
|
||||
long window = Display.getWindow();
|
||||
if (window == NULL) {
|
||||
throw new IllegalStateException("Window not initialized");
|
||||
}
|
||||
|
||||
// Initialize scroll callback
|
||||
scroll = new GLFWScrollCallback() {
|
||||
@Override
|
||||
public void invoke(long window, double xoffset, double yoffset) {
|
||||
scroll(window, xoffset, yoffset);
|
||||
}
|
||||
});
|
||||
glfwSetCursorPosCallback(Display.getWindow(), mousePos = new GLFWCursorPosCallback() {
|
||||
};
|
||||
glfwSetScrollCallback(window, scroll);
|
||||
|
||||
// Initialize cursor position callback
|
||||
mousePos = new GLFWCursorPosCallback() {
|
||||
@Override
|
||||
public void invoke(long window, double xpos, double ypos) {
|
||||
mousepos(window, xpos, ypos);
|
||||
}
|
||||
});
|
||||
};
|
||||
glfwSetCursorPosCallback(window, mousePos);
|
||||
|
||||
// Initialize input state
|
||||
for (int i = 0; i < NBRE_KEY; i++) {
|
||||
state.put(i, NONE);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue