diff --git a/app/src/main/java/chess/view/DDDrender/DDDView.java b/app/src/main/java/chess/view/DDDrender/DDDView.java index 16fe4e7..0fd0a68 100644 --- a/app/src/main/java/chess/view/DDDrender/DDDView.java +++ b/app/src/main/java/chess/view/DDDrender/DDDView.java @@ -232,10 +232,10 @@ public class DDDView extends GameAdaptator implements GameListener { } public void run() { - this.window.addRegularTask((delta) -> { - final float angle = 1f; - this.camera.setRotateAngle(this.camera.getRotateAngle() + angle * delta); - }); + // this.window.addRegularTask((delta) -> { + // final float angle = 1f; + // this.camera.setRotateAngle(this.camera.getRotateAngle() + angle * delta); + // }); this.window.run(); // free OpenGL resources diff --git a/app/src/main/java/chess/view/DDDrender/Window.java b/app/src/main/java/chess/view/DDDrender/Window.java index 22578b1..8804754 100644 --- a/app/src/main/java/chess/view/DDDrender/Window.java +++ b/app/src/main/java/chess/view/DDDrender/Window.java @@ -203,11 +203,8 @@ public class Window implements Closeable { } } - private void checkCursor(int windowWidth, int windowHeight) { - double x[] = new double[1]; - double y[] = new double[1]; - glfwGetCursorPos(this.window, x, y); - Vector2f cursorPos = this.cam.getCursorWorldFloorPos(new Vector2f((float) x[0], (float) y[0]), windowWidth, + private void checkCursor(float cursorPosX, float cursorPosY, int windowWidth, int windowHeight) { + Vector2f cursorPos = this.cam.getCursorWorldFloorPos(new Vector2f(cursorPosX, cursorPosY), windowWidth, windowHeight); Coordinate selectedCell = DDDPlacement.vectorToCoordinates(cursorPos); if (this.lastCell == null) { @@ -236,6 +233,9 @@ public class Window implements Closeable { ImGui.begin("Hello"); ImGui.button("test"); + ImVec2 mousePos = ImGui.getIO().getMousePos(); + ImVec2 framePos = ImGui.getCursorScreenPos(); + checkCursor(mousePos.x - framePos.x, 800 - (mousePos.y - framePos.y), 800, 800); ImGui.image(1, new ImVec2(800, 800)); ImGui.end(); } @@ -281,8 +281,6 @@ public class Window implements Closeable { // invoked during this call. glfwPollEvents(); - checkCursor(width[0], height[0]); - executeTasks(deltaTime); glfwGetWindowSize(window, width, height);