Editor moved into it's own namespace within lunarium

Gui_Panel_Refactor
Joeyrp 4 years ago
parent bd63502601
commit 35dc183111

@ -236,7 +236,7 @@ namespace lunarium
Logger::Log(LogCategory::CORE, LogLevel::FATAL_ERROR, "The Editor is not available with this build"); Logger::Log(LogCategory::CORE, LogLevel::FATAL_ERROR, "The Editor is not available with this build");
return; return;
#else #else
mpRunMode = new Editor; mpRunMode = new editor::Editor;
LogGui::GetInstance().SetStickToWindow(false); LogGui::GetInstance().SetStickToWindow(false);
LuaConsole::GetInstance().SetStickToWindow(false); LuaConsole::GetInstance().SetStickToWindow(false);
#endif #endif

@ -5,8 +5,8 @@
* Mod Date - 2022/01/25 (y/m/d) * Mod Date - 2022/01/25 (y/m/d)
* Description - A 2D fixed-size array of data. Size must be set when * Description - A 2D fixed-size array of data. Size must be set when
* this container is created and can not be changed later. * this container is created and can not be changed later.
* The 0, 0 position is the center of the grid (meaning negative * The 0, 0 position is the center of the grid (so the indices
* indices are valid). * of a 10x10 grid go from 4, 4 to -4, -4).
******************************************************************************/ ******************************************************************************/
#ifndef GRID_H_ #ifndef GRID_H_

@ -20,6 +20,9 @@
namespace lunarium namespace lunarium
{ {
namespace editor
{
Editor::Editor() Editor::Editor()
: mLogCat(-1), mpMainPanel(nullptr), mpFileBrowser(nullptr), mpPath(nullptr), mDoNewProject(false), mDoOpenProject(false), : mLogCat(-1), mpMainPanel(nullptr), mpFileBrowser(nullptr), mpPath(nullptr), mDoNewProject(false), mDoOpenProject(false),
mDoSaveProject(false), mDoSaveAs(false) mDoSaveProject(false), mDoSaveAs(false)
@ -246,4 +249,6 @@ namespace lunarium
{ {
mPanels[PanelType::PT_ABOUT]->SetOpen(true); mPanels[PanelType::PT_ABOUT]->SetOpen(true);
} }
}
} }

@ -21,6 +21,10 @@
namespace lunarium namespace lunarium
{ {
class FileBrowser; class FileBrowser;
namespace editor
{
class MainPanel; class MainPanel;
class Editor : public iRunMode class Editor : public iRunMode
{ {
@ -70,6 +74,8 @@ namespace lunarium
void DestoryPanels(); void DestoryPanels();
void HandleMenuEvents(); void HandleMenuEvents();
}; };
}
} }
#endif // EDITOR_H_ #endif // EDITOR_H_

@ -11,6 +11,8 @@
#include <core/version.h> #include <core/version.h>
namespace lunarium namespace lunarium
{
namespace editor
{ {
AboutPanel::AboutPanel() AboutPanel::AboutPanel()
: Panel(PanelType::PT_ABOUT) : Panel(PanelType::PT_ABOUT)
@ -36,3 +38,4 @@ namespace lunarium
return true; return true;
} }
} }
}

@ -12,6 +12,8 @@
#include "iPanel.h" #include "iPanel.h"
namespace lunarium namespace lunarium
{
namespace editor
{ {
class Editor; class Editor;
class AboutPanel : public Panel class AboutPanel : public Panel
@ -23,5 +25,6 @@ namespace lunarium
bool DoFrame(); bool DoFrame();
}; };
} }
}
#endif // PANEL_ABOUT_H_ #endif // PANEL_ABOUT_H_

@ -10,6 +10,8 @@
#include <dearimgui/imgui.h> #include <dearimgui/imgui.h>
namespace lunarium namespace lunarium
{
namespace editor
{ {
AssetBrowser::AssetBrowser(std::filesystem::path dir) AssetBrowser::AssetBrowser(std::filesystem::path dir)
: Panel(PanelType::PT_ASSET_BROWSER, true), mAssetDirectory(dir), mTreeRoot(nullptr), mSelectedNode(nullptr) : Panel(PanelType::PT_ASSET_BROWSER, true), mAssetDirectory(dir), mTreeRoot(nullptr), mSelectedNode(nullptr)
@ -120,6 +122,7 @@ namespace lunarium
return pNode; return pNode;
} }
} }
}
// void treeChildren(ImGuiTreeNodeFlags node_flags, bool isOpen, int index) // void treeChildren(ImGuiTreeNodeFlags node_flags, bool isOpen, int index)
// { // {

@ -15,6 +15,8 @@
#include <vector> #include <vector>
namespace lunarium namespace lunarium
{
namespace editor
{ {
class AssetBrowser : public Panel class AssetBrowser : public Panel
{ {
@ -46,5 +48,6 @@ namespace lunarium
void DoDirTree(std::filesystem::path dir); void DoDirTree(std::filesystem::path dir);
}; };
} }
}
#endif // ASSET_BROWSER_H_ #endif // ASSET_BROWSER_H_

@ -0,0 +1,43 @@
/******************************************************************************
* File - customProperties.h
* Author - Joey Pollack
* Date - 2022/01/27 (y/m/d)
* Mod Date - 2022/01/27 (y/m/d)
* Description - Handles a custom property
******************************************************************************/
#ifndef CUSTOM_PROPERTIES_H_
#define CUSTOM_PROPERTIES_H_
namespace lunarium
{
namespace editor
{
class CustomProperty
{
public:
// Custom property types
enum CType
{
CPT_INT,
CPT_FLOAT,
CPT_COLOR
};
public:
CustomProperty(CType type);
CType GetType() const;
virtual void Draw() = 0;
private:
CType mType;
};
}
}
#endif // CUSTOM_PROPERTIES_H_

@ -11,6 +11,8 @@
#include <dearimgui/imgui.h> #include <dearimgui/imgui.h>
namespace lunarium namespace lunarium
{
namespace editor
{ {
Panel::Panel(PanelType type, bool isOpen) Panel::Panel(PanelType type, bool isOpen)
: mType(type), mIsOpen(isOpen) : mType(type), mIsOpen(isOpen)
@ -63,3 +65,4 @@ namespace lunarium
mHeight = s.y; mHeight = s.y;
} }
} }
}

@ -10,13 +10,15 @@
#define PANEL_H_ #define PANEL_H_
namespace lunarium namespace lunarium
{
namespace editor
{ {
enum PanelType enum PanelType
{ {
PT_MAIN, PT_MAIN,
PT_ABOUT, PT_ABOUT,
PT_SCENE_TREE, PT_WORLD_TREE,
PT_SCENE_VIEW, PT_WORLD_VIEW,
PT_ASSET_BROWSER, PT_ASSET_BROWSER,
PT_CONSOLE, PT_CONSOLE,
PT_UNKNOWN, PT_UNKNOWN,
@ -48,5 +50,6 @@ namespace lunarium
void UpdateMetaInfo(); void UpdateMetaInfo();
}; };
} }
}
#endif // PANEL_H_ #endif // PANEL_H_

@ -14,6 +14,8 @@
#include <utils/logger.h> #include <utils/logger.h>
namespace lunarium namespace lunarium
{
namespace editor
{ {
MainPanel* MainPanel::mpInstance = nullptr; MainPanel* MainPanel::mpInstance = nullptr;
MainPanel::MainPanel() MainPanel::MainPanel()
@ -153,3 +155,4 @@ namespace lunarium
ImGui::EndMainMenuBar(); ImGui::EndMainMenuBar();
} }
} }
}

@ -12,6 +12,8 @@
#include "iPanel.h" #include "iPanel.h"
namespace lunarium namespace lunarium
{
namespace editor
{ {
class Editor; class Editor;
class MainPanel : public Panel class MainPanel : public Panel
@ -38,5 +40,6 @@ namespace lunarium
void DoMainMenu(); void DoMainMenu();
}; };
} }
}
#endif // PANEL_MAIN_H_ #endif // PANEL_MAIN_H_

@ -0,0 +1,29 @@
/******************************************************************************
* File - properties.h
* Author - Joey Pollack
* Date - 2022/01/26 (y/m/d)
* Mod Date - 2022/01/26 (y/m/d)
* Description - Displayes the properties and components(?) of the selected
* object.
******************************************************************************/
#ifndef PROPERTIES_H_
#define PROPERTIES_H_
#include "iPanel.h"
#include <vector>
namespace lunarium
{
namespace editor
{
class Properties : public Panel
{
public:
};
}
}
#endif // PROPERTIES_H_

@ -1,22 +0,0 @@
/******************************************************************************
* File - sceneTree.h
* Author - Joey Pollack
* Date - 2021/11/04 (y/m/d)
* Mod Date - 2021/11/04 (y/m/d)
* Description - The tree view listing all objects in the scene
******************************************************************************/
#ifndef SCENE_TREE_H_
#define SCENE_TREE_H_
#include "iPanel.h"
namespace lunarium
{
class SceneTree : public Panel
{
};
}
#endif // SCENE_TREE_H_

@ -0,0 +1,48 @@
/******************************************************************************
* File - worldTree.cpp
* Author - Joey Pollack
* Date - 2021/11/04 (y/m/d)
* Mod Date - 2021/11/04 (y/m/d)
* Description - The tree view listing all objects in the world
******************************************************************************/
#include "worldTree.h"
#include <game/world/world.h>
#include <dearimgui/imgui.h>
namespace lunarium
{
namespace editor
{
WorldTree::WorldTree()
: Panel(PT_WORLD_TREE, true), mpWorld(nullptr)
{
}
void WorldTree::SetWorld(World* pWorld)
{
mpWorld = pWorld;
}
World* WorldTree::GetWorld()
{
return mpWorld;
}
bool WorldTree::DoFrame()
{
if (!mIsOpen)
return false;
if (!ImGui::Begin("World Tree", &mIsOpen, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar))
{
ImGui::End();
return false;
}
ImGui::End();
return true;
}
}
}

@ -0,0 +1,34 @@
/******************************************************************************
* File - worldTree.h
* Author - Joey Pollack
* Date - 2021/11/04 (y/m/d)
* Mod Date - 2021/11/04 (y/m/d)
* Description - The tree view listing all objects in the world
******************************************************************************/
#ifndef WORLD_TREE_H_
#define WORLD_TREE_H_
#include "iPanel.h"
namespace lunarium
{
namespace editor
{
class World;
class WorldTree : public Panel
{
public:
WorldTree();
void SetWorld(World* pWorld);
World* GetWorld();
bool DoFrame();
private:
World* mpWorld;
};
}
}
#endif // WORLD_TREE_H_

@ -1,14 +1,17 @@
/****************************************************************************** /******************************************************************************
* File - sceneTree.cpp * File - worldView.cpp
* Author - Joey Pollack * Author - Joey Pollack
* Date - 2021/11/04 (y/m/d) * Date - 2022/01/26 (y/m/d)
* Mod Date - 2021/11/04 (y/m/d) * Mod Date - 2022/01/26 (y/m/d)
* Description - The tree view listing all objects in the scene * Description - A rendered view of the world
******************************************************************************/ ******************************************************************************/
#include "sceneTree.h" #include "worldView.h"
namespace lunarium namespace lunarium
{ {
namespace editor
{
} }
}

@ -0,0 +1,25 @@
/******************************************************************************
* File - worldView.h
* Author - Joey Pollack
* Date - 2022/01/26 (y/m/d)
* Mod Date - 2022/01/26 (y/m/d)
* Description - A rendered view of the world
******************************************************************************/
#ifndef WORLD_VIEW_H_
#define WORLD_VIEW_H_
#include "iPanel.h"
namespace lunarium
{
namespace editor
{
class WorldView : public Panel
{
};
}
}
#endif // WORLD_VIEW_H_

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

Loading…
Cancel
Save