1
0
mirror of synced 2025-02-17 18:59:21 +01:00

Added toggle for ImGui demo window in Debug mode

This commit is contained in:
WerWolv 2020-11-23 22:23:06 +01:00
parent 0d0b2d6962
commit 45bcdc8c46
3 changed files with 16 additions and 3 deletions

View File

@ -16,6 +16,9 @@ if (WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libstdc++ -static-libgcc -static")
endif (WIN32)
SET(CMAKE_CXX_FLAGS_RELEASE -DRELEASE)
SET(CMAKE_CXX_FLAGS_DEBUG -DDEBUG)
add_executable(ImHex
source/main.cpp
source/window.cpp

View File

@ -39,6 +39,7 @@ namespace hex {
GLFWwindow* m_window;
std::vector<View*> m_views;
bool m_fpsVisible = false;
bool m_demoWindowOpen = false;
static inline std::tuple<int, int> s_currShortcut = { -1, -1 };
};

View File

@ -75,6 +75,11 @@ namespace hex {
view->createView();
}
#ifdef DEBUG
if (this->m_demoWindowOpen)
ImGui::ShowDemoWindow(&this->m_demoWindowOpen);
#endif
this->frameEnd();
}
}
@ -107,7 +112,11 @@ namespace hex {
view->createMenu();
if (ImGui::BeginMenu("View")) {
ImGui::Separator();
ImGui::MenuItem("Display FPS", "", &this->m_fpsVisible);
#ifdef DEBUG
ImGui::MenuItem("Demo View", "", &this->m_demoWindowOpen);
#endif
ImGui::EndMenu();
}
@ -161,9 +170,9 @@ namespace hex {
if (!glfwInit())
throw std::runtime_error("Failed to initialize GLFW!");
#ifdef __APPLE__
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
#endif
#ifdef __APPLE__
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
#endif
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);