Introduce ImGui Unity build
This commit is contained in:
parent
abdd19f5e5
commit
29f2abc7b5
217 changed files with 96708 additions and 1 deletions
33
main.cpp
33
main.cpp
|
|
@ -6,6 +6,16 @@
|
|||
#include <GLFW/glfw3.h>
|
||||
#include "glad.c"
|
||||
|
||||
#define IMGUI_IMPL_OPENGL_LOADER_CUSTOM
|
||||
|
||||
#include "imgui/imgui.cpp"
|
||||
#include "imgui/imgui_demo.cpp"
|
||||
#include "imgui/imgui_draw.cpp"
|
||||
#include "imgui/imgui_tables.cpp"
|
||||
#include "imgui/imgui_widgets.cpp"
|
||||
|
||||
#include "imgui/backends/imgui_impl_opengl3.cpp"
|
||||
#include "imgui/backends/imgui_impl_glfw.cpp"
|
||||
|
||||
// fonts
|
||||
#include <ft2build.h>
|
||||
|
|
@ -362,6 +372,15 @@ int main([[maybe_unused]]int argc, [[maybe_unused]]char **argv)
|
|||
}
|
||||
|
||||
hex_program = make_gl_program("shaders/hex.vert", "shaders/hex.frag");
|
||||
|
||||
/* IMGui initalization */
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
static ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
||||
ImGui::StyleColorsDark();
|
||||
ImGui_ImplGlfw_InitForOpenGL(window, true);
|
||||
ImGui_ImplOpenGL3_Init("#version 330 core"); // same as shader version
|
||||
|
||||
double cursor_x;
|
||||
double cursor_y;
|
||||
|
|
@ -513,9 +532,23 @@ int main([[maybe_unused]]int argc, [[maybe_unused]]char **argv)
|
|||
|
||||
glDisable(GL_BLEND);
|
||||
glfwPollEvents();
|
||||
|
||||
// Start the Dear ImGui frame
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
ImGui_ImplGlfw_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
ImGui::Begin("Hi there");
|
||||
ImGui::End();
|
||||
ImGui::Render();
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
ImGui_ImplGlfw_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
|
||||
return 0;
|
||||
exit_main_with_error:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue