Tweak ExampleUi

This commit is contained in:
SpaiR committed 2020-07-11 19:05:55 +03:00
1 parent 640f56b4be
commit 258b9feeb6
2 files changed
+4 -10

No files matched your search

@@ -87,14 +87,13 @@ import static org.lwjgl.glfw.GLFW.glfwSetScrollCallback;
/**
* This class is a straightforward port of the
* <a href="https://raw.githubusercontent.com/ocornut/imgui/v1.76/examples/imgui_impl_glfw.cpp">imgui_impl_glfw.cpp</a>.
* <a href="https://raw.githubusercontent.com/ocornut/imgui/v1.77/examples/imgui_impl_glfw.cpp">imgui_impl_glfw.cpp</a>.
* <p>
* It supports clipboard, gamepad, mouse and keyboard in the same way the original Dear ImGui code does. You can copy-paste this class in your codebase and
* modify the rendering routine in the way you'd like.
*/
public class ImGuiImplGlfw {
// Id of the current GLFW window
// Pointer of the current GLFW window
private long windowPtr;
// For application window properties
+2 -7
View File
@@ -2,7 +2,6 @@ import imgui.type.ImBoolean;
import imgui.ImColor;
import imgui.ImGui;
import imgui.type.ImString;
import imgui.ImVec2;
import imgui.flag.ImGuiColorEditFlags;
import imgui.flag.ImGuiCond;
import imgui.flag.ImGuiInputTextFlags;
@@ -35,8 +34,6 @@ final class ExampleUi {
// Attach image example
private int dukeTexture;
final ImVec2 windowSize = new ImVec2(); // Vector to store "Custom Window" size
final ImVec2 windowPos = new ImVec2(); // Vector to store "Custom Window" position
void init() throws Exception {
dukeTexture = loadTexture(ImageIO.read(new File("src/test/resources/Duke_waving.png")));
@@ -49,10 +46,8 @@ final class ExampleUi {
ImGui.begin("Custom window"); // Start Custom window
// Draw an image in the bottom-right corner of the window
ImGui.getWindowSize(windowSize);
ImGui.getWindowPos(windowPos);
final float xPoint = windowPos.x + windowSize.x - 100;
final float yPoint = windowPos.y + windowSize.y;
final float xPoint = ImGui.getWindowPosX() + ImGui.getWindowSizeX() - 100;
final float yPoint = ImGui.getWindowPosY() + ImGui.getWindowSizeY();
ImGui.getWindowDrawList().addImage(dukeTexture, xPoint, yPoint - 180, xPoint + 100, yPoint);
// Checkbox to show demo window