Tweak ExampleUi
This commit is contained in:
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
|
* 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>
|
* <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
|
* 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.
|
* modify the rendering routine in the way you'd like.
|
||||||
*/
|
*/
|
||||||
public class ImGuiImplGlfw {
|
public class ImGuiImplGlfw {
|
||||||
|
// Pointer of the current GLFW window
|
||||||
// Id of the current GLFW window
|
|
||||||
private long windowPtr;
|
private long windowPtr;
|
||||||
|
|
||||||
// For application window properties
|
// For application window properties
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import imgui.type.ImBoolean;
|
|||||||
import imgui.ImColor;
|
import imgui.ImColor;
|
||||||
import imgui.ImGui;
|
import imgui.ImGui;
|
||||||
import imgui.type.ImString;
|
import imgui.type.ImString;
|
||||||
import imgui.ImVec2;
|
|
||||||
import imgui.flag.ImGuiColorEditFlags;
|
import imgui.flag.ImGuiColorEditFlags;
|
||||||
import imgui.flag.ImGuiCond;
|
import imgui.flag.ImGuiCond;
|
||||||
import imgui.flag.ImGuiInputTextFlags;
|
import imgui.flag.ImGuiInputTextFlags;
|
||||||
@@ -35,8 +34,6 @@ final class ExampleUi {
|
|||||||
|
|
||||||
// Attach image example
|
// Attach image example
|
||||||
private int dukeTexture;
|
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 {
|
void init() throws Exception {
|
||||||
dukeTexture = loadTexture(ImageIO.read(new File("src/test/resources/Duke_waving.png")));
|
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
|
ImGui.begin("Custom window"); // Start Custom window
|
||||||
|
|
||||||
// Draw an image in the bottom-right corner of the window
|
// Draw an image in the bottom-right corner of the window
|
||||||
ImGui.getWindowSize(windowSize);
|
final float xPoint = ImGui.getWindowPosX() + ImGui.getWindowSizeX() - 100;
|
||||||
ImGui.getWindowPos(windowPos);
|
final float yPoint = ImGui.getWindowPosY() + ImGui.getWindowSizeY();
|
||||||
final float xPoint = windowPos.x + windowSize.x - 100;
|
|
||||||
final float yPoint = windowPos.y + windowSize.y;
|
|
||||||
ImGui.getWindowDrawList().addImage(dukeTexture, xPoint, yPoint - 180, xPoint + 100, yPoint);
|
ImGui.getWindowDrawList().addImage(dukeTexture, xPoint, yPoint - 180, xPoint + 100, yPoint);
|
||||||
|
|
||||||
// Checkbox to show demo window
|
// Checkbox to show demo window
|
||||||
|
|||||||
Reference in new issue
Block a user