14 ms·
Try an immediate mode GUI. e.g. Dear Imgui[0]. [0] https://github.com/ocornut/imgui https://github.com/ocornut/imgui Here's the code to draw a slider whose va
by kayamon 7y ago
Try an immediate mode GUI. e.g. Dear Imgui[0].
[0] https://github.com/ocornut/imgui https://github.com/ocornut/imgui
Here's the code to draw a slider whose value is stored in a float:
float f = 0.5f;
ImGui::SliderFloat("my float", &f, 0.0f, 1.0f);
edit: A lot of the problem with GUIs taking so much code is that they duplicate the application's state, requiring a large amount of effort to keep that state synced with their internal state. By instead binding directly against the user's state you can avoid much of the overhead.
- zach43 7y agoI looked at Imgui before for a project, but decided not to go with it since the examples are all over a hundred lines long, for example: https://github.com/ocornut/imgui/blob/master/examples/example_glfw_opengl3/main.cpp https://github.com/ocornut/imgui/blob/master/examples/exampl... It seems like there is a lot of setup / configuration code necessary to wire up Imgui with the graphics rendering back-end. Note that I haven't used Imgui in a real-world project yet. Does anyone know of a better way to set-up Imgui that does't need all this configuration code?
- ocornut 7y agoMost of that code is incompressible to make a portable OpenGL app in C++, not really Dear ImGui's fault. There's literally about ~10 lines of specific imgui code in there other than the 35 lines of example code in the middle of the main function. Your problem is perhaps that you don't want to engage in actually reading that code.
- pariahHN 7y agoI just built a couple things in Go using the Go bindings for Nuklear[0] - most of my GUI work so far has been with wxWidgets in C++/Python and I was very pleasantly surprised at how straightforward building the GUI was. [0] https://github.com/golang-ui/nuklear https://github.com/golang-ui/nuklear