1+ // package imgui
2+ //
3+ // import glm_.vec2.Vec2
4+ // import glm_.vec4.Vec4
5+ // import gln.checkError
6+ // import gln.glClearColor
7+ // import gln.glViewport
8+ // import imgui.functionalProgramming.button
9+ // import imgui.impl.LwjglGL3
10+ // import org.lwjgl.opengl.GL
11+ // import org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT
12+ // import org.lwjgl.opengl.GL11.glClear
13+ // import uno.glfw.GlfwWindow
14+ // import uno.glfw.glfw
15+ //
16+ // fun main(args: Array<String>) {
17+ // test().run()
18+ // }
19+ //
20+ // class test {
21+ //
22+ // val window: GlfwWindow
23+ //
24+ // init {
25+ //
26+ // with(glfw) {
27+ // init()
28+ // windowHint {
29+ // context.version = "3.3"
30+ // profile = "core"
31+ // }
32+ // }
33+ //
34+ // window = GlfwWindow(1280, 720, "ImGui Lwjgl OpenGL3 example")
35+ //
36+ // with(window) {
37+ // makeContextCurrent()
38+ // glfw.swapInterval = 1 // Enable vsync
39+ // show()
40+ // }
41+ //
42+ // GL.createCapabilities()
43+ // }
44+ //
45+ // fun run() {
46+ //
47+ // // Setup ImGui binding
48+ // LwjglGL3.init(window, true)
49+ //
50+ // // Setup style
51+ // ImGui.styleColorsClassic()
52+ // //ImGui.styleColorsDark()
53+ //
54+ // // Load Fonts
55+ // /* - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use
56+ // pushFont()/popFont() to select them.
57+ // - addFontFromFileTTF() will return the Font so you can store it if you need to select the font among multiple.
58+ // - If the file cannot be loaded, the function will return null. Please handle those errors in your application
59+ // (e.g. use an assertion, or display an error and quit).
60+ // - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling
61+ // FontAtlas.build()/getTexDataAsXXXX(), which ImGui_ImplXXXX_NewFrame below will call.
62+ // - Read 'extra_fonts/README.txt' for more instructions and details.
63+ // - Remember that in C/C++ if you want to include a backslash \ in a string literal you need to write
64+ // a double backslash \\ ! */
65+ // //io.Fonts->AddFontDefault();
66+ // //io.Fonts->AddFontFromFileTTF("../../extra_fonts/Roboto-Medium.ttf", 16.0f);
67+ // //io.Fonts->AddFontFromFileTTF("../../extra_fonts/Cousine-Regular.ttf", 15.0f);
68+ // //io.Fonts->AddFontFromFileTTF("../../extra_fonts/DroidSans.ttf", 16.0f);
69+ // //io.Fonts->AddFontFromFileTTF("../../extra_fonts/ProggyTiny.ttf", 10.0f);
70+ // // IO.fonts.addFontFromFileTTF("extraFonts/ArialUni.ttf", 18f, glyphRanges = IO.fonts.glyphRangesJapanese)!!
71+ //
72+ // while (window.isOpen) loop()
73+ //
74+ // LwjglGL3.shutdown()
75+ //
76+ // window.destroy()
77+ // glfw.terminate()
78+ // }
79+ //
80+ // var f = 0f
81+ // val clearColor = Vec4(0.45f, 0.55f, 0.6f, 1f)
82+ // var showAnotherWindow = false
83+ // var showDemo = true
84+ // var listboxItemCurrent = 1
85+ //
86+ // var buf = Array(3) { CharArray(255) }
87+ // var windowOpen = BooleanArray(1)
88+ //
89+ // fun loop() {
90+ //
91+ // /* You can read the IO.wantCaptureMouse, IO.wantCaptureKeyboard flags to tell if dear imgui wants to use your
92+ // inputs.
93+ // - when IO.wantCaptureMouse is true, do not dispatch mouse input data to your main application.
94+ // - when Io.wantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
95+ // Generally you may always pass all inputs to dear imgui, and hide them from your application based on those
96+ // two flags. */
97+ // glfw.pollEvents()
98+ // LwjglGL3.newFrame()
99+ //
100+ // with(ImGui) {
101+ //
102+ // val (w, h) = window.framebufferSize
103+ // setNextWindowPos(Vec2((w - 350) / 2, (h - 350) / 2), Cond.FirstUseEver)
104+ // setNextWindowSize(Vec2(350), Cond.FirstUseEver)
105+ // if (begin("Test", windowOpen, 0)) {
106+ // text("Test")
107+ // // for (i in 0 until buf.size) {
108+ // text("0")
109+ // inputText("", buf[0], InputTextFlags.EnterReturnsTrue.i)
110+ // text("1")
111+ // inputText("", buf[1], InputTextFlags.EnterReturnsTrue.i)
112+ // // }
113+ // end()
114+ // }
115+ // }
116+ //
117+ // // Rendering
118+ // glViewport(window.framebufferSize)
119+ // glClearColor(clearColor)
120+ // glClear(GL_COLOR_BUFFER_BIT)
121+ //
122+ // ImGui.render()
123+ // window.swapBuffers()
124+ //
125+ // checkError("loop") // TODO remove
126+ // }
127+ // }
0 commit comments