From 84cb6465121987aeb49d0fd61d896fafaae9ab2c Mon Sep 17 00:00:00 2001 From: Joey Pollack Date: Fri, 10 Sep 2021 11:13:50 -0400 Subject: [PATCH] ImGui Demo Window working. Build working on Linux. --- scripts/build.sh | 3 ++- src/graphics/gui/gui.cpp | 6 ++++-- src/graphics/{InternalFont.cpp => internalFont.cpp} | 4 ++-- src/graphics/{InternalFont.h => internalFont.h} | 0 src/graphics/{InternalFontData.h => internalFontData.h} | 0 src/input/inputManager.cpp | 1 + src/input/keyboard.cpp | 2 +- src/test_main.cpp | 6 +++--- 8 files changed, 13 insertions(+), 9 deletions(-) rename src/graphics/{InternalFont.cpp => internalFont.cpp} (93%) rename src/graphics/{InternalFont.h => internalFont.h} (100%) rename src/graphics/{InternalFontData.h => internalFontData.h} (100%) diff --git a/scripts/build.sh b/scripts/build.sh index 8f4314f..f4aa409 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,4 +2,5 @@ # This script expects to be run from the parent directory # ex. scripts/build.sh -make -C build/ \ No newline at end of file +make -C build/ +cp test_data/lunarium_state.xml build/lunarium_state.xml \ No newline at end of file diff --git a/src/graphics/gui/gui.cpp b/src/graphics/gui/gui.cpp index 38ad4f3..671fc29 100644 --- a/src/graphics/gui/gui.cpp +++ b/src/graphics/gui/gui.cpp @@ -75,6 +75,7 @@ namespace lunarium mbShowDemo = true; Logger::Log(LogCategory::GRAPHICS, LogLevel::INFO, "ImGui setup"); + mbIsInit = true; return OpRes::OK(); } @@ -101,6 +102,7 @@ namespace lunarium { if (!mbIsInit) return; + ImGui::ShowDemoWindow(&mbShowDemo); ImGui::Render(); @@ -108,10 +110,10 @@ namespace lunarium if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable) { - GLFWwindow* backup_current_context = glfwGetCurrentContext(); + //GLFWwindow* backup_current_context = glfwGetCurrentContext(); ImGui::UpdatePlatformWindows(); ImGui::RenderPlatformWindowsDefault(); - glfwMakeContextCurrent(backup_current_context); + //glfwMakeContextCurrent(backup_current_context); } } } \ No newline at end of file diff --git a/src/graphics/InternalFont.cpp b/src/graphics/internalFont.cpp similarity index 93% rename from src/graphics/InternalFont.cpp rename to src/graphics/internalFont.cpp index 1fc40a2..a2e063b 100644 --- a/src/graphics/InternalFont.cpp +++ b/src/graphics/internalFont.cpp @@ -7,8 +7,8 @@ * ******************************************************************************/ -#include "InternalFont.h" -#include "InternalFontData.h" +#include "internalFont.h" +#include "internalFontData.h" #include #include diff --git a/src/graphics/InternalFont.h b/src/graphics/internalFont.h similarity index 100% rename from src/graphics/InternalFont.h rename to src/graphics/internalFont.h diff --git a/src/graphics/InternalFontData.h b/src/graphics/internalFontData.h similarity index 100% rename from src/graphics/InternalFontData.h rename to src/graphics/internalFontData.h diff --git a/src/input/inputManager.cpp b/src/input/inputManager.cpp index f0c9d64..8ba6206 100644 --- a/src/input/inputManager.cpp +++ b/src/input/inputManager.cpp @@ -11,6 +11,7 @@ #include #include "inputManager.h" #include +#include namespace lunarium { diff --git a/src/input/keyboard.cpp b/src/input/keyboard.cpp index ac6bfc6..0ac1e6b 100644 --- a/src/input/keyboard.cpp +++ b/src/input/keyboard.cpp @@ -62,7 +62,7 @@ namespace lunarium k.Code = (KeyCode)(i + 48); char name[2]; - sprintf_s(name, 2, "%d", i); + sprintf(name, "%d", i); k.Name = std::string(name); k.ShiftName = std::string() + numShift[i]; diff --git a/src/test_main.cpp b/src/test_main.cpp index e774d6a..2bca7ab 100644 --- a/src/test_main.cpp +++ b/src/test_main.cpp @@ -7,7 +7,7 @@ #include #include #include "utils/logger.h" -#include "utils/OpRes.h" +#include "utils/opRes.h" #include "core/state.h" #include "core/version.h" #include "utils/args.h" @@ -230,10 +230,10 @@ int main(int argc, char** argv) // For this specific demo app we could also call glfwMakeContextCurrent(window) directly) if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) { - GLFWwindow* backup_current_context = glfwGetCurrentContext(); + // GLFWwindow* backup_current_context = glfwGetCurrentContext(); ImGui::UpdatePlatformWindows(); ImGui::RenderPlatformWindowsDefault(); - glfwMakeContextCurrent(backup_current_context); + //glfwMakeContextCurrent(backup_current_context); } glfwSwapBuffers(window);