imgui #10
@@ -232,10 +232,10 @@ public class DDDView extends GameAdaptator implements GameListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
this.window.addRegularTask((delta) -> {
|
// this.window.addRegularTask((delta) -> {
|
||||||
final float angle = 1f;
|
// final float angle = 1f;
|
||||||
this.camera.setRotateAngle(this.camera.getRotateAngle() + angle * delta);
|
// this.camera.setRotateAngle(this.camera.getRotateAngle() + angle * delta);
|
||||||
});
|
// });
|
||||||
this.window.run();
|
this.window.run();
|
||||||
|
|
||||||
// free OpenGL resources
|
// free OpenGL resources
|
||||||
|
|||||||
@@ -203,11 +203,8 @@ public class Window implements Closeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkCursor(int windowWidth, int windowHeight) {
|
private void checkCursor(float cursorPosX, float cursorPosY, int windowWidth, int windowHeight) {
|
||||||
double x[] = new double[1];
|
Vector2f cursorPos = this.cam.getCursorWorldFloorPos(new Vector2f(cursorPosX, cursorPosY), windowWidth,
|
||||||
double y[] = new double[1];
|
|
||||||
glfwGetCursorPos(this.window, x, y);
|
|
||||||
Vector2f cursorPos = this.cam.getCursorWorldFloorPos(new Vector2f((float) x[0], (float) y[0]), windowWidth,
|
|
||||||
windowHeight);
|
windowHeight);
|
||||||
Coordinate selectedCell = DDDPlacement.vectorToCoordinates(cursorPos);
|
Coordinate selectedCell = DDDPlacement.vectorToCoordinates(cursorPos);
|
||||||
if (this.lastCell == null) {
|
if (this.lastCell == null) {
|
||||||
@@ -236,6 +233,9 @@ public class Window implements Closeable {
|
|||||||
|
|
||||||
ImGui.begin("Hello");
|
ImGui.begin("Hello");
|
||||||
ImGui.button("test");
|
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.image(1, new ImVec2(800, 800));
|
||||||
ImGui.end();
|
ImGui.end();
|
||||||
}
|
}
|
||||||
@@ -281,8 +281,6 @@ public class Window implements Closeable {
|
|||||||
// invoked during this call.
|
// invoked during this call.
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
|
|
||||||
checkCursor(width[0], height[0]);
|
|
||||||
|
|
||||||
executeTasks(deltaTime);
|
executeTasks(deltaTime);
|
||||||
|
|
||||||
glfwGetWindowSize(window, width, height);
|
glfwGetWindowSize(window, width, height);
|
||||||
|
|||||||
Reference in New Issue
Block a user