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.
Gui_Panel_Refactor
Joeyrp 4 years ago
parent e05f3bb20a
commit 6e2f676f11

@ -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)

@ -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 <gui/dearimgui/imgui.h>
#include <core/core.h>
#include <input/inputManager.h>
#include <cstring>
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<std::string>* 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;
}
}

@ -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 <gui/panel.h>
#include <vector>
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<std::string>* 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<std::string> mCommandHistory;
bool mbNewCommand;
int mRecalledCommand;
float mAlpha;
bool mIsFocused;
private:
void CheckFocus();
};
}
#endif // CONSOLE_H_

@ -9,7 +9,9 @@
#include "core.h"
#include "version.h"
#include <imgui.h>
#include "console.h"
#include <gui/dearimgui/imgui.h>
#include <LunariumConfig.h>
// Run modes
@ -21,8 +23,8 @@
#include <input/inputManager.h>
#include <graphics/opengl/glGraphics.h>
#include <gui/gui.h>
#include <gui/logGui.h>
#include <gui/luaConsole.h>
// #include <gui/logGui.h>
// #include <gui/luaConsole.h>
#include <scripting/scriptManager.h>
#include <scripting/coreAPI.h>
@ -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);

@ -11,6 +11,8 @@
#include "state.h"
#include "iRunMode.h"
#include <gui/panel.h>
#include <gui/panel_defs.h>
#include <utils/logger.h>
#include <utils/args.h>
#include <utils/frameCounter.h>
@ -56,6 +58,9 @@ namespace lunarium
bool mbMidTextureRender;
bool mbShowGuiDemo;
// Panels
std::map<gui::PanelType, gui::Panel*> mPanels;
// Log Files
std::ofstream mMasterLogFile;
std::ofstream mErrorLogFile;

@ -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
)

@ -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}" )

@ -7,7 +7,7 @@
* and saving files.
******************************************************************************/
#include "fileBrowser.h"
#include "file_browser.h"
#include <algorithm>
#include <cstring>
@ -16,7 +16,7 @@
#include <graphics/igraphics.h>
#include <internal_data/dataManager.h>
#include <utils/stb/stb_image.h>
#include <dearimgui/imgui.h>
#include "dearimgui/imgui.h"
namespace lunarium
{

@ -8,19 +8,19 @@
#include "gui.h"
#include <window/window.h>
#include <GLFW/glfw3.h>
#include <utils/helpers.h>
#include <utils/logger.h>
#include <imgui.h>
#include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h>
#include "dearimgui/imgui.h"
#include "dearimgui/imgui_impl_glfw.h"
#include "dearimgui/imgui_impl_opengl3.h"
#include <graphics/internalFont.h>
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);
}
}

@ -11,20 +11,21 @@
#include <utils/opRes.h>
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;
};
}

@ -6,14 +6,13 @@
* Description - Base class for all editor panels
******************************************************************************/
#include "iPanel.h"
#include "panel.h"
#include <dearimgui/imgui.h>
#include <editor/editor.h>
#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)

@ -13,11 +13,12 @@
#include <string>
struct ImGuiInputTextCallbackData;
namespace lunarium
{
namespace editor
namespace gui
{
class Editor;
class Panel
{
public:

@ -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,
};

@ -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 ../../

@ -12,9 +12,9 @@
#include <core/core.h>
#include <core/version.h>
#include <utils/logger.h>
#include <gui/fileBrowser.h>
#include <gui/file_browser.h>
#include <internal_data/dataManager.h>
#include <dearimgui/imgui.h>
#include <gui/dearimgui/imgui.h>
#include "panels/assetBrowser.h"
@ -22,6 +22,8 @@
// Tools
#include "tools/map_editor/map_editor.h"
using namespace lunarium::gui;
namespace lunarium
{
namespace editor

@ -11,7 +11,6 @@
#include <core/iRunMode.h>
#include <utils/opRes.h>
#include "panels/iPanel.h"
#include "project/project.h"

@ -9,8 +9,8 @@
#include "panel_manager.h"
#include "editor.h"
#include <utils/logger.h>
#include <dearimgui/imgui.h>
#include <dearimgui/imgui_internal.h> // To use the DockWindowXXX methods
#include <gui/dearimgui/imgui.h>
#include <gui/dearimgui/imgui_internal.h> // To use the DockWindowXXX methods
#include <filesystem>
// 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

@ -9,10 +9,9 @@
#ifndef PANEL_MANAGER_H_
#define PANEL_MANAGER_H_
#include "panels/panel_defs.h"
#include <utils/opRes.h>
//#include "panels/mainPanel.h"
#include "panels/iPanel.h"
#include <gui/panel.h>
#include <map>
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<PanelType, Panel*> mPanels;
std::map<gui::PanelType, gui::Panel*> mPanels;
unsigned int mDockSpaceID;
std::map<PanelDockZone, unsigned int> mDockZoneIDs;
std::map<gui::PanelDockZone, unsigned int> mDockZoneIDs;
private:
static PanelManager* mpInstance;

@ -7,7 +7,7 @@
******************************************************************************/
#include "about.h"
#include <dearimgui/imgui.h>
#include <gui/dearimgui/imgui.h>
#include <core/version.h>
#include <editor/editor.h>
@ -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)
{
}

@ -9,14 +9,14 @@
#ifndef PANEL_ABOUT_H_
#define PANEL_ABOUT_H_
#include "iPanel.h"
#include <gui/panel.h>
namespace lunarium
{
namespace editor
{
class Editor;
class AboutPanel : public Panel
class AboutPanel : public gui::Panel
{
public:
AboutPanel();

@ -7,7 +7,7 @@
******************************************************************************/
#include "assetBrowser.h"
#include <dearimgui/imgui.h>
#include <gui/dearimgui/imgui.h>
#include <editor/editor.h>
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);

@ -9,7 +9,7 @@
#ifndef ASSET_BROWSER_H_
#define ASSET_BROWSER_H_
#include "iPanel.h"
#include <gui/panel.h>
#include <filesystem>
#include <vector>
@ -18,7 +18,7 @@ namespace lunarium
{
namespace editor
{
class AssetBrowser : public Panel
class AssetBrowser : public gui::Panel
{
public:
AssetBrowser(std::filesystem::path dir);

@ -8,13 +8,13 @@
******************************************************************************/
#include "propertiesView.h"
#include <dearimgui/imgui.h>
#include <gui/dearimgui/imgui.h>
#include <editor/editor.h>
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)
{
}

@ -10,7 +10,7 @@
#ifndef PROPERTIES_H_
#define PROPERTIES_H_
#include "iPanel.h"
#include <gui/panel.h>
#include <vector>
namespace lunarium
@ -18,7 +18,7 @@ namespace lunarium
namespace editor
{
class CustromProperty;
class PropertiesView : public Panel
class PropertiesView : public gui::Panel
{
public:

@ -8,7 +8,7 @@
#include "worldTree.h"
#include <game/world/world.h>
#include <dearimgui/imgui.h>
#include <gui/dearimgui/imgui.h>
#include <editor/editor.h>
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)
{
}

@ -9,14 +9,14 @@
#ifndef WORLD_TREE_H_
#define WORLD_TREE_H_
#include "iPanel.h"
#include <gui/panel.h>
namespace lunarium
{
class World;
namespace editor
{
class WorldTree : public Panel
class WorldTree : public gui::Panel
{
public:
WorldTree();

@ -9,7 +9,7 @@
#include "worldView.h"
#include <utils\logger.h>
#include <game/world/world.h>
#include <dearimgui/imgui.h>
#include <gui/dearimgui/imgui.h>
#include <editor/editor.h>
#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)
{
}

@ -9,7 +9,7 @@
#ifndef WORLD_VIEW_H_
#define WORLD_VIEW_H_
#include "iPanel.h"
#include <gui/panel.h>
namespace lunarium
{
@ -18,7 +18,7 @@ namespace lunarium
namespace editor
{
class Editor;
class WorldView : public Panel
class WorldView : public gui::Panel
{
public:
WorldView();

@ -9,8 +9,8 @@
#include "map_editor.h"
#include <editor/editor.h>
#include <editor/panels/iPanel.h>
#include <dearimgui/imgui.h>
#include <gui/panel.h>
#include <gui/dearimgui/imgui.h>
namespace lunarium { namespace editor
{

@ -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<Panel*> mPanels;
std::vector<gui::Panel*> mPanels;
enum PanelTypes
{

@ -10,4 +10,4 @@ target_include_directories(tester
PUBLIC ../../../external/box2d/include
)
target_link_libraries(tester box2d utils)
target_link_libraries(tester box2d utils dearimgui)

@ -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)
{

@ -26,6 +26,8 @@ namespace lunarium
void OnTick(double delta);
void OnRender(IGraphics* g);
void SwitchScene(int id);
private:
Tester(const Tester&) = delete;

@ -1,6 +1,6 @@
<State>
<DataDirectory>data/</DataDirectory>
<Mode Type="editor" />
<Mode Type="test" />
<Display Renderer="opengl" IsFullScreen="false" VSyncEnabled="true">
<FullScreenResolution Width="1920" Height="1080" />
<WindowedSize Width="1280" Height="720" />

Loading…
Cancel
Save