From 6e2f676f11d0b30864cc049a54c5f65d21c2e817 Mon Sep 17 00:00:00 2001 From: Joeyrp Date: Thu, 10 Feb 2022 14:22:14 -0500 Subject: [PATCH] gui code refactored and moved into its own library the LuaConsole and LogGui have been merged into a single Console panel. The appearance looks good and the lua console part works. Still need to add the log history and log filter options. --- CMakeLists.txt | 14 +- src/core/console.cpp | 169 ++++++++++++++++++ src/core/console.h | 51 ++++++ src/core/core.cpp | 67 ++++--- src/core/core.h | 5 + src/internal_libs/gui/CMakeLists.txt | 22 +++ .../{ => gui}/dearimgui/CMakeLists.txt | 2 +- .../{ => gui}/dearimgui/LICENSE.txt | 0 .../{ => gui}/dearimgui/imconfig.h | 0 .../{ => gui}/dearimgui/imgui.cpp | 0 src/internal_libs/{ => gui}/dearimgui/imgui.h | 0 .../{ => gui}/dearimgui/imgui_demo.cpp | 0 .../{ => gui}/dearimgui/imgui_draw.cpp | 0 .../{ => gui}/dearimgui/imgui_impl_glfw.cpp | 0 .../{ => gui}/dearimgui/imgui_impl_glfw.h | 0 .../dearimgui/imgui_impl_opengl3.cpp | 0 .../{ => gui}/dearimgui/imgui_impl_opengl3.h | 0 .../dearimgui/imgui_impl_opengl3_loader.h | 0 .../{ => gui}/dearimgui/imgui_internal.h | 0 .../{ => gui}/dearimgui/imgui_tables.cpp | 0 .../{ => gui}/dearimgui/imgui_widgets.cpp | 0 .../{ => gui}/dearimgui/imstb_rectpack.h | 0 .../{ => gui}/dearimgui/imstb_textedit.h | 0 .../{ => gui}/dearimgui/imstb_truetype.h | 0 .../gui/file_browser.cpp} | 4 +- .../gui/file_browser.h} | 0 src/{ => internal_libs}/gui/gui.cpp | 22 +-- src/{ => internal_libs}/gui/gui.h | 9 +- src/{ => internal_libs}/gui/logGui.cpp | 0 src/{ => internal_libs}/gui/logGui.h | 0 src/{ => internal_libs}/gui/luaConsole.cpp | 0 src/{ => internal_libs}/gui/luaConsole.h | 0 .../gui/panel.cpp} | 7 +- .../iPanel.h => internal_libs/gui/panel.h} | 5 +- .../panels => internal_libs/gui}/panel_defs.h | 8 +- src/run_modes/editor/CMakeLists.txt | 3 +- src/run_modes/editor/editor.cpp | 6 +- src/run_modes/editor/editor.h | 1 - src/run_modes/editor/panel_manager.cpp | 10 +- src/run_modes/editor/panel_manager.h | 15 +- src/run_modes/editor/panels/about.cpp | 4 +- src/run_modes/editor/panels/about.h | 4 +- src/run_modes/editor/panels/assetBrowser.cpp | 4 +- src/run_modes/editor/panels/assetBrowser.h | 4 +- .../editor/panels/propertiesView.cpp | 4 +- src/run_modes/editor/panels/propertiesView.h | 4 +- src/run_modes/editor/panels/worldTree.cpp | 4 +- src/run_modes/editor/panels/worldTree.h | 4 +- src/run_modes/editor/panels/worldView.cpp | 4 +- src/run_modes/editor/panels/worldView.h | 4 +- .../editor/{panels => }/properties/property.h | 0 .../editor/tools/map_editor/map_editor.cpp | 4 +- .../editor/tools/map_editor/map_editor.h | 7 +- src/run_modes/tester/CMakeLists.txt | 2 +- src/run_modes/tester/tester.cpp | 5 +- src/run_modes/tester/tester.h | 2 + test_data/engine_state.xml | 2 +- 57 files changed, 369 insertions(+), 113 deletions(-) create mode 100644 src/core/console.cpp create mode 100644 src/core/console.h create mode 100644 src/internal_libs/gui/CMakeLists.txt rename src/internal_libs/{ => gui}/dearimgui/CMakeLists.txt (62%) rename src/internal_libs/{ => gui}/dearimgui/LICENSE.txt (100%) rename src/internal_libs/{ => gui}/dearimgui/imconfig.h (100%) rename src/internal_libs/{ => gui}/dearimgui/imgui.cpp (100%) rename src/internal_libs/{ => gui}/dearimgui/imgui.h (100%) rename src/internal_libs/{ => gui}/dearimgui/imgui_demo.cpp (100%) rename src/internal_libs/{ => gui}/dearimgui/imgui_draw.cpp (100%) rename src/internal_libs/{ => gui}/dearimgui/imgui_impl_glfw.cpp (100%) rename src/internal_libs/{ => gui}/dearimgui/imgui_impl_glfw.h (100%) rename src/internal_libs/{ => gui}/dearimgui/imgui_impl_opengl3.cpp (100%) rename src/internal_libs/{ => gui}/dearimgui/imgui_impl_opengl3.h (100%) rename src/internal_libs/{ => gui}/dearimgui/imgui_impl_opengl3_loader.h (100%) rename src/internal_libs/{ => gui}/dearimgui/imgui_internal.h (100%) rename src/internal_libs/{ => gui}/dearimgui/imgui_tables.cpp (100%) rename src/internal_libs/{ => gui}/dearimgui/imgui_widgets.cpp (100%) rename src/internal_libs/{ => gui}/dearimgui/imstb_rectpack.h (100%) rename src/internal_libs/{ => gui}/dearimgui/imstb_textedit.h (100%) rename src/internal_libs/{ => gui}/dearimgui/imstb_truetype.h (100%) rename src/{gui/fileBrowser.cpp => internal_libs/gui/file_browser.cpp} (99%) rename src/{gui/fileBrowser.h => internal_libs/gui/file_browser.h} (100%) rename src/{ => internal_libs}/gui/gui.cpp (88%) rename src/{ => internal_libs}/gui/gui.h (84%) rename src/{ => internal_libs}/gui/logGui.cpp (100%) rename src/{ => internal_libs}/gui/logGui.h (100%) rename src/{ => internal_libs}/gui/luaConsole.cpp (100%) rename src/{ => internal_libs}/gui/luaConsole.h (100%) rename src/{run_modes/editor/panels/iPanel.cpp => internal_libs/gui/panel.cpp} (93%) rename src/{run_modes/editor/panels/iPanel.h => internal_libs/gui/panel.h} (94%) rename src/{run_modes/editor/panels => internal_libs/gui}/panel_defs.h (81%) rename src/run_modes/editor/{panels => }/properties/property.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43e972c..fa90e76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ set(LUNARIUM_SRC "src/core/core.cpp" "src/core/state.cpp" "src/core/version.cpp" +"src/core/console.cpp" "src/core/iRunMode.cpp" "src/window/window.cpp" "src/graphics/opengl/glGraphics.cpp" @@ -36,10 +37,6 @@ set(LUNARIUM_SRC "src/internal_data/dataManager.cpp" "src/input/keyboard.cpp" "src/input/inputManager.cpp" -"src/gui/gui.cpp" -"src/gui/fileBrowser.cpp" -"src/gui/logGui.cpp" -"src/gui/luaConsole.cpp" "src/scripting/scriptManager.cpp" "src/scripting/coreAPI.cpp" ) @@ -98,7 +95,10 @@ add_subdirectory(external/glad/src) add_subdirectory(external/glm) # add dearimgui -add_subdirectory(src/internal_libs/dearimgui) +add_subdirectory(src/internal_libs/gui/dearimgui) + +# add gui +add_subdirectory(src/internal_libs/gui) # add utils add_subdirectory(src/internal_libs/utils) @@ -145,7 +145,7 @@ target_include_directories(${PROJECT_NAME} target_link_directories(${PROJECT_NAME} PRIVATE external/glfw/src PRIVATE external/glm - PRIVATE src/internal_libs/dearimgui + PRIVATE src/internal_libs/gui/dearimgui PRIVATE src/internal_libs/utils PRIVATE src/internal_libs/assets PRIVATE src/run_modes/tester @@ -154,7 +154,7 @@ target_link_directories(${PROJECT_NAME} PRIVATE external/box2d/bin ) -target_link_libraries(${PROJECT_NAME} box2d glfw glad glm dearimgui utils assets lua_static pugixml freetype tester game) +target_link_libraries(${PROJECT_NAME} box2d glfw glad glm gui dearimgui utils assets lua_static pugixml freetype tester game) if (NOT NO_EDITOR) target_link_libraries(${PROJECT_NAME} editor) diff --git a/src/core/console.cpp b/src/core/console.cpp new file mode 100644 index 0000000..8fb82e8 --- /dev/null +++ b/src/core/console.cpp @@ -0,0 +1,169 @@ +/****************************************************************************** +* File - console.h +* Author - Joey Pollack +* Date - 2022/02/09 (y/m/d) +* Mod Date - 2022/02/09 (y/m/d) +* Description - Engine console for viewing the debug log and entering lua + commands +******************************************************************************/ + +#include "console.h" +#include +#include +#include +#include +namespace lunarium +{ + Console::Console() + : Panel(gui::PanelType::PT_CORE_CONSOLE, "Core Console", gui::PanelDockZone::DDZ_NONE, false), + mbNewCommand(false), mRecalledCommand(-1), mAlpha(0.5f), mIsFocused(false) + { + memset(mBuffer, 0, LUA_CON_BUFFER_SIZE); + } + + bool Console::IsFocused() const + { + return mIsFocused; + } + + void Console::Update(float dt) + { + + } + + bool Console::DoFrame() + { + if (!mIsOpen) + return false; + + if (Core::Input().IsKeyDown(KeyCode::ESCAPE, true)) + { + mRecalledCommand = -1; + } + + ImGuiViewport* pView = ImGui::GetMainViewport(); + + + float myHeight = pView->WorkSize.y / 3.0f; + float y = pView->WorkPos.y + (myHeight * 2); + + + ImGui::SetNextWindowPos(ImVec2(pView->WorkPos.x, y), ImGuiCond_Always); + ImGui::SetNextWindowSize(ImVec2(pView->WorkSize.x, myHeight), ImGuiCond_Always); + ImGui::SetNextWindowBgAlpha(mAlpha); + if (!ImGui::Begin("Console", &mIsOpen, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar + | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse)) + { + ImGui::End(); + return mIsOpen; + } + + + + float history_height = myHeight - 45; + ImGui::BeginChild("history", ImVec2(0, history_height), false, ImGuiWindowFlags_AlwaysVerticalScrollbar); + mIsFocused = ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); + for (int i = 0; i < mCommandHistory.size(); i++) + { + const char* msg = mCommandHistory[i].c_str(); + int len = strlen(msg); + + if (i == mRecalledCommand) + { + ImGui::TextColored(ImVec4(0.2f, 0.9f, 0.5f, 1.0f), msg); + } + else + { + ImGui::TextUnformatted(msg); + } + } + + if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) + ImGui::SetScrollHereY(1.0f); + + ImGui::EndChild(); + ImGui::Separator(); + ImGui::BeginChild("input", ImVec2(0, 20), false, ImGuiWindowFlags_NoScrollbar); + mIsFocused = ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); + if (ImGui::InputText("command", mBuffer, LUA_CON_BUFFER_SIZE, ImGuiInputTextFlags_EnterReturnsTrue + | ImGuiInputTextFlags_CallbackHistory, Console::MyCallback, (void*)this)) + { + mCommandHistory.push_back(mBuffer); + memset(mBuffer, 0, LUA_CON_BUFFER_SIZE); + mbNewCommand = true; + + // Doesn't keep the focus on the input text field + // Might be another way to do it now + ImGui::SetKeyboardFocusHere(-1); + //mAlpha = ImGui::IsWindowFocused() ? 0.75f : 0.1f; + } + + ImGui::EndChild(); + ImGui::End(); + + mAlpha = mIsFocused ? 0.75f : 0.5f; + + return mIsOpen; + } + + const std::vector* Console::GetCommandHistory() const + { + return &mCommandHistory; + } + + std::string Console::GetLastCommand() + { + return mCommandHistory.back(); + } + + bool Console::GetNewCommand(std::string& command) + { + if (mbNewCommand) + { + command = mCommandHistory.back(); + mbNewCommand = false; + return true; + } + + return false; + } + + + int Console::MyCallback(ImGuiInputTextCallbackData* data) + { + if (data->EventFlag == ImGuiInputTextFlags_CallbackHistory) + { + bool changeCommand = false; + Console* pConsole = (Console*)data->UserData; + if (data->EventKey == ImGuiKey_UpArrow) + { + pConsole->mRecalledCommand--; + if (pConsole->mRecalledCommand <= -1) + { + pConsole->mRecalledCommand = pConsole->mCommandHistory.size() - 1; + } + changeCommand = true; + } + else if (data->EventKey == ImGuiKey_DownArrow) + { + pConsole->mRecalledCommand++; + if (pConsole->mRecalledCommand >= pConsole->mCommandHistory.size()) + { + pConsole->mRecalledCommand = 0; + } + changeCommand = true; + } + + if (changeCommand) + { + memset(pConsole->mBuffer, 0, LUA_CON_BUFFER_SIZE); + strcpy(pConsole->mBuffer, pConsole->mCommandHistory[pConsole->mRecalledCommand].c_str()); + data->DeleteChars(0, data->BufTextLen); + data->InsertChars(0, pConsole->mBuffer); + data->SelectAll(); + } + } + return 0; + } + +} \ No newline at end of file diff --git a/src/core/console.h b/src/core/console.h new file mode 100644 index 0000000..1f3ec54 --- /dev/null +++ b/src/core/console.h @@ -0,0 +1,51 @@ +/****************************************************************************** +* File - console.h +* Author - Joey Pollack +* Date - 2022/02/09 (y/m/d) +* Mod Date - 2022/02/09 (y/m/d) +* Description - Engine console for viewing the debug log and entering lua + commands +******************************************************************************/ + +#ifndef CONSOLE_H_ +#define CONSOLE_H_ + +#include +#include + +namespace lunarium +{ + const int LUA_CON_BUFFER_SIZE = 64; + class Console : public gui::Panel + { + public: + Console(); + virtual void Update(float dt); + virtual bool DoFrame(); + + bool IsFocused() const; + + // LUA COMMAND STUFF + const std::vector* GetCommandHistory() const; + std::string GetLastCommand(); + bool GetNewCommand(std::string& command); // returns true if there is a new and false if not + + static int MyCallback(ImGuiInputTextCallbackData* data); + + private: + // LUA COMMAND STUFF + char mBuffer[LUA_CON_BUFFER_SIZE]; + std::vector mCommandHistory; + bool mbNewCommand; + int mRecalledCommand; + float mAlpha; + bool mIsFocused; + + private: + void CheckFocus(); + + }; +} + + +#endif // CONSOLE_H_ \ No newline at end of file diff --git a/src/core/core.cpp b/src/core/core.cpp index d977b54..9635e47 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -9,7 +9,9 @@ #include "core.h" #include "version.h" -#include +#include "console.h" + +#include #include // Run modes @@ -21,8 +23,8 @@ #include #include #include -#include -#include +// #include +// #include #include #include @@ -79,8 +81,8 @@ namespace lunarium CoreAPI::FreeInstance(); ScriptManager::FreeInstance(); - LuaConsole::FreeInstance(); - LogGui::FreeInstance(); + //LuaConsole::FreeInstance(); + //LogGui::FreeInstance(); GUI::GetInstance().Shutdown(); GUI::FreeInstance(); @@ -132,12 +134,12 @@ namespace lunarium // Init the Debug log window OpRes result; - result = LogGui::GetInstance().Initialize(); - if (Failed(result)) - { - Logger::Log(LogCategory::CORE, LogLevel::WARNING, - "Could not initialized the debug log window: %s", result.Description); - } + // result = LogGui::GetInstance().Initialize(); + // if (Failed(result)) + // { + // Logger::Log(LogCategory::CORE, LogLevel::WARNING, + // "Could not initialized the debug log window: %s", result.Description); + // } Logger::Log(LogCategory::CORE, LogLevel::INFO, "Running Lunarium version %s", Version::GetVersion().ToString().c_str()); @@ -204,7 +206,7 @@ namespace lunarium mpInput->Initialize(mpWindow); // GUI - result = mGUI.Initialize(mpWindow); + result = mGUI.Initialize(mpWindow->GetWindow()); if (Failed(result)) { Logger::Log(LogCategory::CORE, LogLevel::WARNING, @@ -229,11 +231,13 @@ namespace lunarium } // RUN MODE + mPanels[gui::PanelType::PT_CORE_CONSOLE] = nullptr; const char* types[] = { "game", "editor", "test" }; Logger::Log(LogCategory::CORE, LogLevel::INFO, "Running in mode: %s", types[mState.Mode]); if (RunMode::MODE_TEST == mState.Mode) { mpRunMode = new Tester; + mPanels[gui::PanelType::PT_CORE_CONSOLE] = new Console; } else if (RunMode::MODE_EDITOR == mState.Mode) @@ -243,8 +247,8 @@ namespace lunarium return; #else mpRunMode = new editor::Editor; - LogGui::GetInstance().SetStickToWindow(false); - LuaConsole::GetInstance().SetStickToWindow(false); + // LogGui::GetInstance().SetStickToWindow(false); + // LuaConsole::GetInstance().SetStickToWindow(false); #endif } @@ -290,27 +294,13 @@ namespace lunarium title += std::to_string(mFrameCounter.GetFrameData().CurrentFPS); glfwSetWindowTitle(mpWindow->GetWindow(), title.c_str()); + // Get pointers to gui panels + Console* con = (Console*)mPanels[gui::PanelType::PT_CORE_CONSOLE]; + // Poll input Window::PollEvents(); auto keyEvents = mpInput->PollKeys(); - // HIDE/SHOW THE DEBUG WINDOWS - if (mpInput->IsKeyPressed(KeyCode::F2, true)) - { - mbShowGuiDemo = !mbShowGuiDemo; - } - - if (mpInput->IsKeyPressed(KeyCode::F3, true)) - { - //Logger::Log(LogCategory::CORE, LogLevel::INFO, "Toggling the Debug Log Window"); - LogGui::GetInstance().SetShow(!LogGui::GetInstance().IsShown()); - } - - if (mpInput->IsKeyPressed(KeyCode::F4, true)) - { - LuaConsole::GetInstance().SetShow(!LuaConsole::GetInstance().IsShown()); - } - if (!ImGui::GetIO().WantCaptureKeyboard) { // Send key events @@ -328,7 +318,7 @@ namespace lunarium { // Check if there is a new LUA command std::string command; - if (LuaConsole::GetInstance().GetNewCommand(command)) + if (con && con->GetNewCommand(command)) { // Logger::Log(LogCategory::CORE, LogLevel::INFO, "New LUA command: %s", command.c_str()); OpRes result = ScriptManager::RunScript(command.c_str()); @@ -343,6 +333,12 @@ namespace lunarium // UPDATE game state mpRunMode->OnTick(mFrameCounter.GetFrameData().LastFrameTime); + // DEBUG PANELS + if (Core::Input().IsKeyPressed(KeyCode::F2, true) && con) + { + con->SetOpen(!con->IsOpen()); + } + // RENDER if (mbMidTextureRender) @@ -356,14 +352,11 @@ namespace lunarium mbMidRender = true; // Gui windows - if (mbShowGuiDemo) + if (con) { - mGUI.ShowDemoWindow(); + con->DoFrame(); } - LogGui::GetInstance().Show(); - LuaConsole::GetInstance().Show(); - // Run mode mpRunMode->OnRender(mpGraphics); diff --git a/src/core/core.h b/src/core/core.h index c2246f5..b128624 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -11,6 +11,8 @@ #include "state.h" #include "iRunMode.h" +#include +#include #include #include #include @@ -56,6 +58,9 @@ namespace lunarium bool mbMidTextureRender; bool mbShowGuiDemo; + // Panels + std::map mPanels; + // Log Files std::ofstream mMasterLogFile; std::ofstream mErrorLogFile; diff --git a/src/internal_libs/gui/CMakeLists.txt b/src/internal_libs/gui/CMakeLists.txt new file mode 100644 index 0000000..2db9096 --- /dev/null +++ b/src/internal_libs/gui/CMakeLists.txt @@ -0,0 +1,22 @@ + +# Source Files +set(GUI_SRC +"gui.cpp" +"file_browser.cpp" +"panel.cpp" +) + +add_library(gui ${GUI_SRC}) +target_link_libraries(gui utils assets dearimgui glfw) + +target_include_directories(gui + PUBLIC "${PROJECT_BINARY_DIR}" + PUBLIC ../../ + PUBLIC ../../internal_libs + PUBLIC ../../run_modes + PUBLIC ../../../external/glm + PUBLIC ../../../external/glad/include + PUBLIC ../../../external/glfw/include + PUBLIC ../../../external/box2d/include + PUBLIC ../../../external/pugixml/src +) \ No newline at end of file diff --git a/src/internal_libs/dearimgui/CMakeLists.txt b/src/internal_libs/gui/dearimgui/CMakeLists.txt similarity index 62% rename from src/internal_libs/dearimgui/CMakeLists.txt rename to src/internal_libs/gui/dearimgui/CMakeLists.txt index adf7ccb..02f8a99 100644 --- a/src/internal_libs/dearimgui/CMakeLists.txt +++ b/src/internal_libs/gui/dearimgui/CMakeLists.txt @@ -1,7 +1,7 @@ add_library(dearimgui imgui.cpp imgui_demo.cpp imgui_widgets.cpp imgui_tables.cpp imgui_draw.cpp imgui_impl_glfw.cpp imgui_impl_opengl3.cpp) target_include_directories(dearimgui - PUBLIC ../../../external/glfw/include + PUBLIC ../../../../external/glfw/include ) # message( " current source dir: ${CMAKE_CURRENT_SOURCE_DIR}" ) \ No newline at end of file diff --git a/src/internal_libs/dearimgui/LICENSE.txt b/src/internal_libs/gui/dearimgui/LICENSE.txt similarity index 100% rename from src/internal_libs/dearimgui/LICENSE.txt rename to src/internal_libs/gui/dearimgui/LICENSE.txt diff --git a/src/internal_libs/dearimgui/imconfig.h b/src/internal_libs/gui/dearimgui/imconfig.h similarity index 100% rename from src/internal_libs/dearimgui/imconfig.h rename to src/internal_libs/gui/dearimgui/imconfig.h diff --git a/src/internal_libs/dearimgui/imgui.cpp b/src/internal_libs/gui/dearimgui/imgui.cpp similarity index 100% rename from src/internal_libs/dearimgui/imgui.cpp rename to src/internal_libs/gui/dearimgui/imgui.cpp diff --git a/src/internal_libs/dearimgui/imgui.h b/src/internal_libs/gui/dearimgui/imgui.h similarity index 100% rename from src/internal_libs/dearimgui/imgui.h rename to src/internal_libs/gui/dearimgui/imgui.h diff --git a/src/internal_libs/dearimgui/imgui_demo.cpp b/src/internal_libs/gui/dearimgui/imgui_demo.cpp similarity index 100% rename from src/internal_libs/dearimgui/imgui_demo.cpp rename to src/internal_libs/gui/dearimgui/imgui_demo.cpp diff --git a/src/internal_libs/dearimgui/imgui_draw.cpp b/src/internal_libs/gui/dearimgui/imgui_draw.cpp similarity index 100% rename from src/internal_libs/dearimgui/imgui_draw.cpp rename to src/internal_libs/gui/dearimgui/imgui_draw.cpp diff --git a/src/internal_libs/dearimgui/imgui_impl_glfw.cpp b/src/internal_libs/gui/dearimgui/imgui_impl_glfw.cpp similarity index 100% rename from src/internal_libs/dearimgui/imgui_impl_glfw.cpp rename to src/internal_libs/gui/dearimgui/imgui_impl_glfw.cpp diff --git a/src/internal_libs/dearimgui/imgui_impl_glfw.h b/src/internal_libs/gui/dearimgui/imgui_impl_glfw.h similarity index 100% rename from src/internal_libs/dearimgui/imgui_impl_glfw.h rename to src/internal_libs/gui/dearimgui/imgui_impl_glfw.h diff --git a/src/internal_libs/dearimgui/imgui_impl_opengl3.cpp b/src/internal_libs/gui/dearimgui/imgui_impl_opengl3.cpp similarity index 100% rename from src/internal_libs/dearimgui/imgui_impl_opengl3.cpp rename to src/internal_libs/gui/dearimgui/imgui_impl_opengl3.cpp diff --git a/src/internal_libs/dearimgui/imgui_impl_opengl3.h b/src/internal_libs/gui/dearimgui/imgui_impl_opengl3.h similarity index 100% rename from src/internal_libs/dearimgui/imgui_impl_opengl3.h rename to src/internal_libs/gui/dearimgui/imgui_impl_opengl3.h diff --git a/src/internal_libs/dearimgui/imgui_impl_opengl3_loader.h b/src/internal_libs/gui/dearimgui/imgui_impl_opengl3_loader.h similarity index 100% rename from src/internal_libs/dearimgui/imgui_impl_opengl3_loader.h rename to src/internal_libs/gui/dearimgui/imgui_impl_opengl3_loader.h diff --git a/src/internal_libs/dearimgui/imgui_internal.h b/src/internal_libs/gui/dearimgui/imgui_internal.h similarity index 100% rename from src/internal_libs/dearimgui/imgui_internal.h rename to src/internal_libs/gui/dearimgui/imgui_internal.h diff --git a/src/internal_libs/dearimgui/imgui_tables.cpp b/src/internal_libs/gui/dearimgui/imgui_tables.cpp similarity index 100% rename from src/internal_libs/dearimgui/imgui_tables.cpp rename to src/internal_libs/gui/dearimgui/imgui_tables.cpp diff --git a/src/internal_libs/dearimgui/imgui_widgets.cpp b/src/internal_libs/gui/dearimgui/imgui_widgets.cpp similarity index 100% rename from src/internal_libs/dearimgui/imgui_widgets.cpp rename to src/internal_libs/gui/dearimgui/imgui_widgets.cpp diff --git a/src/internal_libs/dearimgui/imstb_rectpack.h b/src/internal_libs/gui/dearimgui/imstb_rectpack.h similarity index 100% rename from src/internal_libs/dearimgui/imstb_rectpack.h rename to src/internal_libs/gui/dearimgui/imstb_rectpack.h diff --git a/src/internal_libs/dearimgui/imstb_textedit.h b/src/internal_libs/gui/dearimgui/imstb_textedit.h similarity index 100% rename from src/internal_libs/dearimgui/imstb_textedit.h rename to src/internal_libs/gui/dearimgui/imstb_textedit.h diff --git a/src/internal_libs/dearimgui/imstb_truetype.h b/src/internal_libs/gui/dearimgui/imstb_truetype.h similarity index 100% rename from src/internal_libs/dearimgui/imstb_truetype.h rename to src/internal_libs/gui/dearimgui/imstb_truetype.h diff --git a/src/gui/fileBrowser.cpp b/src/internal_libs/gui/file_browser.cpp similarity index 99% rename from src/gui/fileBrowser.cpp rename to src/internal_libs/gui/file_browser.cpp index 2663794..4eacca6 100644 --- a/src/gui/fileBrowser.cpp +++ b/src/internal_libs/gui/file_browser.cpp @@ -7,7 +7,7 @@ * and saving files. ******************************************************************************/ -#include "fileBrowser.h" +#include "file_browser.h" #include #include @@ -16,7 +16,7 @@ #include #include #include -#include +#include "dearimgui/imgui.h" namespace lunarium { diff --git a/src/gui/fileBrowser.h b/src/internal_libs/gui/file_browser.h similarity index 100% rename from src/gui/fileBrowser.h rename to src/internal_libs/gui/file_browser.h diff --git a/src/gui/gui.cpp b/src/internal_libs/gui/gui.cpp similarity index 88% rename from src/gui/gui.cpp rename to src/internal_libs/gui/gui.cpp index e3c2166..b5d11f4 100644 --- a/src/gui/gui.cpp +++ b/src/internal_libs/gui/gui.cpp @@ -8,19 +8,19 @@ #include "gui.h" -#include +#include #include #include -#include -#include -#include +#include "dearimgui/imgui.h" +#include "dearimgui/imgui_impl_glfw.h" +#include "dearimgui/imgui_impl_opengl3.h" #include namespace lunarium { GUI* GUI::mpInstance = nullptr; GUI::GUI() - : mbIsInit(false), mbShowDemo(false) + : mbIsInit(false)//, mbShowDemo(false) { } @@ -41,7 +41,7 @@ namespace lunarium mpInstance = nullptr; } - OpRes GUI::Initialize(Window* pWindow) + OpRes GUI::Initialize(GLFWwindow* pWindow) { if (mbIsInit) { @@ -64,6 +64,8 @@ namespace lunarium // Setup Dear ImGui style ImGui::StyleColorsDark(); + //ImGui::StyleColorsClassic(); + // When viewports are enabled we tweak WindowRounding/WindowBg so platform windows can look identical to regular ones. ImGuiStyle& style = ImGui::GetStyle(); @@ -74,12 +76,12 @@ namespace lunarium } // Setup Platform/Renderer backends - ImGui_ImplGlfw_InitForOpenGL(pWindow->GetWindow(), true); + ImGui_ImplGlfw_InitForOpenGL(pWindow, true); ImGui_ImplOpenGL3_Init(System::GetGLSLVersionString().c_str()); // Our state ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); - mbShowDemo = true; + //mbShowDemo = true; Logger::Log(LogCategory::GRAPHICS, LogLevel::INFO, "ImGui setup"); mbIsInit = true; @@ -124,11 +126,11 @@ namespace lunarium } } - void GUI::ShowDemoWindow() + void GUI::ShowDemoWindow(bool& show) { if (!mbIsInit) return; - ImGui::ShowDemoWindow(&mbShowDemo); + ImGui::ShowDemoWindow(&show); } } \ No newline at end of file diff --git a/src/gui/gui.h b/src/internal_libs/gui/gui.h similarity index 84% rename from src/gui/gui.h rename to src/internal_libs/gui/gui.h index 0697ac0..e023992 100644 --- a/src/gui/gui.h +++ b/src/internal_libs/gui/gui.h @@ -11,20 +11,21 @@ #include +struct GLFWwindow; + namespace lunarium { - class Window; class GUI { public: static GUI& GetInstance(); static void FreeInstance(); - OpRes Initialize(Window* pWindow); + OpRes Initialize(GLFWwindow* pWindow); void Shutdown(); void NewFrame(); void EndFrame(); - void ShowDemoWindow(); + void ShowDemoWindow(bool& show); bool WantCaptureKeyboard() const; @@ -36,7 +37,7 @@ namespace lunarium private: static GUI* mpInstance; bool mbIsInit; - bool mbShowDemo; + //bool mbShowDemo; }; } diff --git a/src/gui/logGui.cpp b/src/internal_libs/gui/logGui.cpp similarity index 100% rename from src/gui/logGui.cpp rename to src/internal_libs/gui/logGui.cpp diff --git a/src/gui/logGui.h b/src/internal_libs/gui/logGui.h similarity index 100% rename from src/gui/logGui.h rename to src/internal_libs/gui/logGui.h diff --git a/src/gui/luaConsole.cpp b/src/internal_libs/gui/luaConsole.cpp similarity index 100% rename from src/gui/luaConsole.cpp rename to src/internal_libs/gui/luaConsole.cpp diff --git a/src/gui/luaConsole.h b/src/internal_libs/gui/luaConsole.h similarity index 100% rename from src/gui/luaConsole.h rename to src/internal_libs/gui/luaConsole.h diff --git a/src/run_modes/editor/panels/iPanel.cpp b/src/internal_libs/gui/panel.cpp similarity index 93% rename from src/run_modes/editor/panels/iPanel.cpp rename to src/internal_libs/gui/panel.cpp index 715e023..97626f9 100644 --- a/src/run_modes/editor/panels/iPanel.cpp +++ b/src/internal_libs/gui/panel.cpp @@ -6,14 +6,13 @@ * Description - Base class for all editor panels ******************************************************************************/ -#include "iPanel.h" +#include "panel.h" -#include -#include +#include "dearimgui/imgui.h" namespace lunarium { -namespace editor +namespace gui { Panel::Panel(PanelType type, std::string name, PanelDockZone dock_zone, bool isOpen) : mType(type), mIsOpen(isOpen), mPanelName(name), mDockZone(dock_zone) diff --git a/src/run_modes/editor/panels/iPanel.h b/src/internal_libs/gui/panel.h similarity index 94% rename from src/run_modes/editor/panels/iPanel.h rename to src/internal_libs/gui/panel.h index 1a04e98..5e60ba9 100644 --- a/src/run_modes/editor/panels/iPanel.h +++ b/src/internal_libs/gui/panel.h @@ -13,11 +13,12 @@ #include +struct ImGuiInputTextCallbackData; + namespace lunarium { -namespace editor +namespace gui { - class Editor; class Panel { public: diff --git a/src/run_modes/editor/panels/panel_defs.h b/src/internal_libs/gui/panel_defs.h similarity index 81% rename from src/run_modes/editor/panels/panel_defs.h rename to src/internal_libs/gui/panel_defs.h index b6f5556..7a3d8b4 100644 --- a/src/run_modes/editor/panels/panel_defs.h +++ b/src/internal_libs/gui/panel_defs.h @@ -9,17 +9,21 @@ #ifndef PANEL_DEFS_H_ #define PANEL_DEFS_H_ -namespace lunarium { namespace editor +namespace lunarium { namespace gui { enum PanelType { + // core + PT_CORE_CONSOLE, + + // editor PT_MAIN, PT_ABOUT, PT_WORLD_TREE, PT_WORLD_VIEW, PT_ASSET_BROWSER, PT_PROPERTIES_VIEW, - PT_CONSOLE, + PT_EDITOR_CONSOLE, PT_UNKNOWN, }; diff --git a/src/run_modes/editor/CMakeLists.txt b/src/run_modes/editor/CMakeLists.txt index 0b770f0..8611309 100644 --- a/src/run_modes/editor/CMakeLists.txt +++ b/src/run_modes/editor/CMakeLists.txt @@ -4,7 +4,6 @@ set(EDITOR_SRC "editor.cpp" "panel_manager.cpp" "project/project.cpp" -"panels/iPanel.cpp" "panels/about.cpp" "panels/assetBrowser.cpp" "panels/worldTree.cpp" @@ -15,6 +14,8 @@ set(EDITOR_SRC add_library(editor ${EDITOR_SRC}) +target_link_libraries(editor gui utils assets) + target_include_directories(editor PUBLIC "${PROJECT_BINARY_DIR}" PUBLIC ../../ diff --git a/src/run_modes/editor/editor.cpp b/src/run_modes/editor/editor.cpp index ba547ac..e13ea12 100644 --- a/src/run_modes/editor/editor.cpp +++ b/src/run_modes/editor/editor.cpp @@ -12,9 +12,9 @@ #include #include #include -#include +#include #include -#include +#include #include "panels/assetBrowser.h" @@ -22,6 +22,8 @@ // Tools #include "tools/map_editor/map_editor.h" +using namespace lunarium::gui; + namespace lunarium { namespace editor diff --git a/src/run_modes/editor/editor.h b/src/run_modes/editor/editor.h index 0cb6257..6661a87 100644 --- a/src/run_modes/editor/editor.h +++ b/src/run_modes/editor/editor.h @@ -11,7 +11,6 @@ #include #include -#include "panels/iPanel.h" #include "project/project.h" diff --git a/src/run_modes/editor/panel_manager.cpp b/src/run_modes/editor/panel_manager.cpp index b14d306..6b601e2 100644 --- a/src/run_modes/editor/panel_manager.cpp +++ b/src/run_modes/editor/panel_manager.cpp @@ -9,8 +9,8 @@ #include "panel_manager.h" #include "editor.h" #include -#include -#include // To use the DockWindowXXX methods +#include +#include // To use the DockWindowXXX methods #include // Panels @@ -20,6 +20,8 @@ #include "panels/worldView.h" #include "panels/propertiesView.h" +using namespace lunarium::gui; + namespace lunarium { namespace editor { PanelManager* PanelManager::mpInstance = nullptr; @@ -202,9 +204,9 @@ namespace lunarium { namespace editor ImGui::DockBuilderSetNodeSize(mDockSpaceID, Viewport->Size); //ImGui::DockBuilderSetNodePos(mDockSpaces.Main, Viewport->WorkPos); - ImGui::DockBuilderSplitNode(mDockSpaceID, ImGuiDir_Left, 0.25f, &mDockZoneIDs[PanelDockZone::DDZ_LEFT], &mDockZoneIDs[PanelDockZone::DDZ_CENTER]); + ImGui::DockBuilderSplitNode(mDockSpaceID, ImGuiDir_Down, 0.25f, &mDockZoneIDs[PanelDockZone::DDZ_BOTTOM], &mDockZoneIDs[PanelDockZone::DDZ_CENTER]); ImGui::DockBuilderSplitNode(mDockZoneIDs[PanelDockZone::DDZ_CENTER], ImGuiDir_Right, 0.2f, &mDockZoneIDs[PanelDockZone::DDZ_RIGHT], &mDockZoneIDs[PanelDockZone::DDZ_CENTER]); - ImGui::DockBuilderSplitNode(mDockZoneIDs[PanelDockZone::DDZ_CENTER], ImGuiDir_Down, 0.25f, &mDockZoneIDs[PanelDockZone::DDZ_BOTTOM], &mDockZoneIDs[PanelDockZone::DDZ_CENTER]); + ImGui::DockBuilderSplitNode(mDockZoneIDs[PanelDockZone::DDZ_CENTER], ImGuiDir_Left, 0.2f, &mDockZoneIDs[PanelDockZone::DDZ_LEFT], &mDockZoneIDs[PanelDockZone::DDZ_CENTER]); ImGui::DockBuilderFinish(mDockSpaceID); // Dock Panels diff --git a/src/run_modes/editor/panel_manager.h b/src/run_modes/editor/panel_manager.h index a669bd4..f92f667 100644 --- a/src/run_modes/editor/panel_manager.h +++ b/src/run_modes/editor/panel_manager.h @@ -9,10 +9,9 @@ #ifndef PANEL_MANAGER_H_ #define PANEL_MANAGER_H_ -#include "panels/panel_defs.h" #include //#include "panels/mainPanel.h" -#include "panels/iPanel.h" +#include #include namespace lunarium{ @@ -29,10 +28,10 @@ namespace editor OpRes Initialize(Editor* editor); void Shutdown(); - void OpenPanel(PanelType type); - void ClosePanel(PanelType type); - bool IsOpen(PanelType type); - Panel* GetPanel(PanelType type); + void OpenPanel(gui::PanelType type); + void ClosePanel(gui::PanelType type); + bool IsOpen(gui::PanelType type); + gui::Panel* GetPanel(gui::PanelType type); void ResetDocking(); @@ -43,9 +42,9 @@ namespace editor Editor* mpEditor; // MainPanel* mpMainPanel; bool mResetDockSpace; - std::map mPanels; + std::map mPanels; unsigned int mDockSpaceID; - std::map mDockZoneIDs; + std::map mDockZoneIDs; private: static PanelManager* mpInstance; diff --git a/src/run_modes/editor/panels/about.cpp b/src/run_modes/editor/panels/about.cpp index 3880eac..cc5c9d7 100644 --- a/src/run_modes/editor/panels/about.cpp +++ b/src/run_modes/editor/panels/about.cpp @@ -7,7 +7,7 @@ ******************************************************************************/ #include "about.h" -#include +#include #include #include @@ -16,7 +16,7 @@ namespace lunarium namespace editor { AboutPanel::AboutPanel() - : Panel(PanelType::PT_ABOUT, "About", PanelDockZone::DDZ_NONE) + : Panel(gui::PanelType::PT_ABOUT, "About", gui::PanelDockZone::DDZ_NONE) { } diff --git a/src/run_modes/editor/panels/about.h b/src/run_modes/editor/panels/about.h index c28dbf4..d9807ae 100644 --- a/src/run_modes/editor/panels/about.h +++ b/src/run_modes/editor/panels/about.h @@ -9,14 +9,14 @@ #ifndef PANEL_ABOUT_H_ #define PANEL_ABOUT_H_ -#include "iPanel.h" +#include namespace lunarium { namespace editor { class Editor; - class AboutPanel : public Panel + class AboutPanel : public gui::Panel { public: AboutPanel(); diff --git a/src/run_modes/editor/panels/assetBrowser.cpp b/src/run_modes/editor/panels/assetBrowser.cpp index 45e9064..61d9093 100644 --- a/src/run_modes/editor/panels/assetBrowser.cpp +++ b/src/run_modes/editor/panels/assetBrowser.cpp @@ -7,7 +7,7 @@ ******************************************************************************/ #include "assetBrowser.h" -#include +#include #include namespace lunarium @@ -15,7 +15,7 @@ namespace lunarium namespace editor { AssetBrowser::AssetBrowser(std::filesystem::path dir) - : Panel(PanelType::PT_ASSET_BROWSER, "Asset Browser", PanelDockZone::DDZ_BOTTOM, true), + : Panel(gui::PanelType::PT_ASSET_BROWSER, "Asset Browser", gui::PanelDockZone::DDZ_BOTTOM, true), mAssetDirectory(dir), mTreeRoot(nullptr), mSelectedNode(nullptr) { mTreeRoot = ReloadAssets(mAssetDirectory); diff --git a/src/run_modes/editor/panels/assetBrowser.h b/src/run_modes/editor/panels/assetBrowser.h index 85da9cc..99fb31b 100644 --- a/src/run_modes/editor/panels/assetBrowser.h +++ b/src/run_modes/editor/panels/assetBrowser.h @@ -9,7 +9,7 @@ #ifndef ASSET_BROWSER_H_ #define ASSET_BROWSER_H_ -#include "iPanel.h" +#include #include #include @@ -18,7 +18,7 @@ namespace lunarium { namespace editor { - class AssetBrowser : public Panel + class AssetBrowser : public gui::Panel { public: AssetBrowser(std::filesystem::path dir); diff --git a/src/run_modes/editor/panels/propertiesView.cpp b/src/run_modes/editor/panels/propertiesView.cpp index d0163b9..3f3a63b 100644 --- a/src/run_modes/editor/panels/propertiesView.cpp +++ b/src/run_modes/editor/panels/propertiesView.cpp @@ -8,13 +8,13 @@ ******************************************************************************/ #include "propertiesView.h" -#include +#include #include namespace lunarium { namespace editor { PropertiesView::PropertiesView() - : Panel(PT_PROPERTIES_VIEW, "Properties", PanelDockZone::DDZ_RIGHT, true) + : Panel(gui::PanelType::PT_PROPERTIES_VIEW, "Properties", gui::PanelDockZone::DDZ_RIGHT, true) { } diff --git a/src/run_modes/editor/panels/propertiesView.h b/src/run_modes/editor/panels/propertiesView.h index 7377643..bc5063b 100644 --- a/src/run_modes/editor/panels/propertiesView.h +++ b/src/run_modes/editor/panels/propertiesView.h @@ -10,7 +10,7 @@ #ifndef PROPERTIES_H_ #define PROPERTIES_H_ -#include "iPanel.h" +#include #include namespace lunarium @@ -18,7 +18,7 @@ namespace lunarium namespace editor { class CustromProperty; - class PropertiesView : public Panel + class PropertiesView : public gui::Panel { public: diff --git a/src/run_modes/editor/panels/worldTree.cpp b/src/run_modes/editor/panels/worldTree.cpp index bc6e873..16aadc1 100644 --- a/src/run_modes/editor/panels/worldTree.cpp +++ b/src/run_modes/editor/panels/worldTree.cpp @@ -8,7 +8,7 @@ #include "worldTree.h" #include -#include +#include #include namespace lunarium @@ -16,7 +16,7 @@ namespace lunarium namespace editor { WorldTree::WorldTree() - : Panel(PT_WORLD_TREE, "World Tree", PanelDockZone::DDZ_LEFT, true), mpWorld(nullptr) + : Panel(gui::PanelType::PT_WORLD_TREE, "World Tree", gui::PanelDockZone::DDZ_LEFT, true), mpWorld(nullptr) { } diff --git a/src/run_modes/editor/panels/worldTree.h b/src/run_modes/editor/panels/worldTree.h index a99f500..03f86ce 100644 --- a/src/run_modes/editor/panels/worldTree.h +++ b/src/run_modes/editor/panels/worldTree.h @@ -9,14 +9,14 @@ #ifndef WORLD_TREE_H_ #define WORLD_TREE_H_ -#include "iPanel.h" +#include namespace lunarium { class World; namespace editor { - class WorldTree : public Panel + class WorldTree : public gui::Panel { public: WorldTree(); diff --git a/src/run_modes/editor/panels/worldView.cpp b/src/run_modes/editor/panels/worldView.cpp index 791db83..87a8d8d 100644 --- a/src/run_modes/editor/panels/worldView.cpp +++ b/src/run_modes/editor/panels/worldView.cpp @@ -9,7 +9,7 @@ #include "worldView.h" #include #include -#include +#include #include #include "../panel_manager.h" @@ -18,7 +18,7 @@ namespace lunarium namespace editor { WorldView::WorldView() - : Panel(PT_WORLD_VIEW, "World View", PanelDockZone::DDZ_CENTER ,true), mpWorld(nullptr) + : Panel(gui::PanelType::PT_WORLD_VIEW, "World View", gui::PanelDockZone::DDZ_CENTER ,true), mpWorld(nullptr) { } diff --git a/src/run_modes/editor/panels/worldView.h b/src/run_modes/editor/panels/worldView.h index e2cd678..2f6dc76 100644 --- a/src/run_modes/editor/panels/worldView.h +++ b/src/run_modes/editor/panels/worldView.h @@ -9,7 +9,7 @@ #ifndef WORLD_VIEW_H_ #define WORLD_VIEW_H_ -#include "iPanel.h" +#include namespace lunarium { @@ -18,7 +18,7 @@ namespace lunarium namespace editor { class Editor; - class WorldView : public Panel + class WorldView : public gui::Panel { public: WorldView(); diff --git a/src/run_modes/editor/panels/properties/property.h b/src/run_modes/editor/properties/property.h similarity index 100% rename from src/run_modes/editor/panels/properties/property.h rename to src/run_modes/editor/properties/property.h diff --git a/src/run_modes/editor/tools/map_editor/map_editor.cpp b/src/run_modes/editor/tools/map_editor/map_editor.cpp index 3f0a00c..9acd6a9 100644 --- a/src/run_modes/editor/tools/map_editor/map_editor.cpp +++ b/src/run_modes/editor/tools/map_editor/map_editor.cpp @@ -9,8 +9,8 @@ #include "map_editor.h" #include -#include -#include +#include +#include namespace lunarium { namespace editor { diff --git a/src/run_modes/editor/tools/map_editor/map_editor.h b/src/run_modes/editor/tools/map_editor/map_editor.h index 6a21a03..b5b2506 100644 --- a/src/run_modes/editor/tools/map_editor/map_editor.h +++ b/src/run_modes/editor/tools/map_editor/map_editor.h @@ -16,10 +16,13 @@ namespace lunarium { class IGraphics; + namespace gui { + class Panel; + } + namespace editor { class Editor; - class Panel; class MapEditor { public: @@ -45,7 +48,7 @@ namespace editor bool mMapLoaded; bool mIsDirty; Editor* mpEditor; - std::vector mPanels; + std::vector mPanels; enum PanelTypes { diff --git a/src/run_modes/tester/CMakeLists.txt b/src/run_modes/tester/CMakeLists.txt index cc1e75a..f74c09e 100644 --- a/src/run_modes/tester/CMakeLists.txt +++ b/src/run_modes/tester/CMakeLists.txt @@ -10,4 +10,4 @@ target_include_directories(tester PUBLIC ../../../external/box2d/include ) -target_link_libraries(tester box2d utils) \ No newline at end of file +target_link_libraries(tester box2d utils dearimgui) \ No newline at end of file diff --git a/src/run_modes/tester/tester.cpp b/src/run_modes/tester/tester.cpp index f87d1f8..4a16b7e 100644 --- a/src/run_modes/tester/tester.cpp +++ b/src/run_modes/tester/tester.cpp @@ -35,8 +35,8 @@ namespace lunarium Logger::Log(mLogCat, LogLevel::INFO, "EDITOR DETECTED!"); #endif - // mpScene = new SimpleRenderScene(mLogCat); - mpScene = new PhysicsScene(mLogCat); + mpScene = new SimpleRenderScene(mLogCat); + // mpScene = new PhysicsScene(mLogCat); mpScene->OnLoad(); @@ -48,6 +48,7 @@ namespace lunarium delete mpScene; mpScene = nullptr; } + void Tester::OnTick(double delta) { diff --git a/src/run_modes/tester/tester.h b/src/run_modes/tester/tester.h index 77eb391..18fc08d 100644 --- a/src/run_modes/tester/tester.h +++ b/src/run_modes/tester/tester.h @@ -26,6 +26,8 @@ namespace lunarium void OnTick(double delta); void OnRender(IGraphics* g); + void SwitchScene(int id); + private: Tester(const Tester&) = delete; diff --git a/test_data/engine_state.xml b/test_data/engine_state.xml index 277eb02..5cf7851 100644 --- a/test_data/engine_state.xml +++ b/test_data/engine_state.xml @@ -1,6 +1,6 @@ data/ - +