Viewport #94
|
@ -0,0 +1,48 @@
|
|||
[Window][MainStatusBar]
|
||||
Pos=0,1060
|
||||
Size=1920,20
|
||||
Collapsed=0
|
||||
|
||||
[Window][SHEditorMenuBar]
|
||||
Pos=0,24
|
||||
Size=1920,1036
|
||||
Collapsed=0
|
||||
|
||||
[Window][Hierarchy Panel]
|
||||
Pos=0,120
|
||||
Size=225,940
|
||||
Collapsed=0
|
||||
DockId=0x00000004,0
|
||||
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
[Window][Inspector]
|
||||
Pos=1686,24
|
||||
Size=234,1036
|
||||
Collapsed=0
|
||||
DockId=0x00000006,0
|
||||
|
||||
[Window][Profiler]
|
||||
Pos=0,24
|
||||
Size=225,94
|
||||
Collapsed=0
|
||||
DockId=0x00000003,0
|
||||
|
||||
[Window][Viewport]
|
||||
Pos=227,24
|
||||
Size=1457,1036
|
||||
Collapsed=0
|
||||
DockId=0x00000002,0
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=8,55 Size=1920,1036 Split=X
|
||||
DockNode ID=0x00000005 Parent=0xC5C9B8AB SizeRef=1684,1036 Split=X
|
||||
DockNode ID=0x00000001 Parent=0x00000005 SizeRef=225,1036 Split=Y Selected=0x1E6EB881
|
||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=225,94 Selected=0x1E6EB881
|
||||
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=225,940 Selected=0xE096E5AE
|
||||
DockNode ID=0x00000002 Parent=0x00000005 SizeRef=1293,1036 CentralNode=1 Selected=0x13926F0B
|
||||
DockNode ID=0x00000006 Parent=0xC5C9B8AB SizeRef=234,1036 Selected=0xE7039252
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
[Window][MainStatusBar]
|
||||
Pos=0,1167
|
||||
Size=2314,20
|
||||
Collapsed=0
|
||||
|
||||
[Window][SHEditorMenuBar]
|
||||
Pos=0,48
|
||||
Size=2314,1119
|
||||
Collapsed=0
|
||||
|
||||
[Window][Hierarchy Panel]
|
||||
Pos=0,152
|
||||
Size=208,1015
|
||||
Collapsed=0
|
||||
DockId=0x00000004,0
|
||||
|
||||
[Window][Debug##Default]
|
||||
Pos=60,60
|
||||
Size=400,400
|
||||
Collapsed=0
|
||||
|
||||
[Window][Inspector]
|
||||
Pos=2044,48
|
||||
Size=270,1119
|
||||
Collapsed=0
|
||||
DockId=0x00000006,0
|
||||
|
||||
[Window][Profiler]
|
||||
Pos=0,48
|
||||
Size=208,102
|
||||
Collapsed=0
|
||||
DockId=0x00000003,0
|
||||
|
||||
[Window][Viewport]
|
||||
Pos=210,48
|
||||
Size=1832,1119
|
||||
Collapsed=0
|
||||
DockId=0x00000002,0
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0xC5C9B8AB Window=0xBE4044E9 Pos=-7,358 Size=2314,1119 Split=X
|
||||
DockNode ID=0x00000005 Parent=0xC5C9B8AB SizeRef=2042,1036 Split=X
|
||||
DockNode ID=0x00000001 Parent=0x00000005 SizeRef=208,1036 Split=Y Selected=0x1E6EB881
|
||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=225,94 Selected=0x1E6EB881
|
||||
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=225,940 Selected=0xE096E5AE
|
||||
DockNode ID=0x00000002 Parent=0x00000005 SizeRef=1832,1036 CentralNode=1 Selected=0x13926F0B
|
||||
DockNode ID=0x00000006 Parent=0xC5C9B8AB SizeRef=270,1036 Selected=0xE7039252
|
||||
|
|
@ -66,8 +66,8 @@ namespace SHADE
|
|||
editor->selectedEntities.clear();
|
||||
}
|
||||
ImGui::SeparatorEx(ImGuiSeparatorFlags_Horizontal);
|
||||
ImGui::End();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void SHHierarchyPanel::Exit()
|
||||
|
@ -75,6 +75,11 @@ namespace SHADE
|
|||
SHEditorWindow::Exit();
|
||||
}
|
||||
|
||||
void SHHierarchyPanel::SetScrollTo(EntityID eid)
|
||||
{
|
||||
scrollTo = eid;
|
||||
}
|
||||
|
||||
//#==============================================================#
|
||||
//|| Private Member Functions ||
|
||||
//#==============================================================#
|
||||
|
@ -82,7 +87,20 @@ namespace SHADE
|
|||
{
|
||||
if (ImGui::BeginMenuBar())
|
||||
{
|
||||
if (ImGui::SmallButton(ICON_MD_ADD))
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetContentRegionAvail().x - 35.0f);
|
||||
if(ImGui::SmallButton(ICON_MD_DESELECT))
|
||||
{
|
||||
auto editor = SHSystemManager::GetSystem<SHEditor>();
|
||||
editor->selectedEntities.clear();
|
||||
}
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("Clear Selections");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
if (ImGui::SmallButton(ICON_MD_ADD_CIRCLE))
|
||||
{
|
||||
SHEntityManager::CreateEntity();
|
||||
}
|
||||
|
@ -103,6 +121,13 @@ namespace SHADE
|
|||
//Get node data (Children, eid, selected)
|
||||
auto& children = currentNode->GetChildren();
|
||||
EntityID eid = currentNode->GetEntityID();
|
||||
|
||||
if(scrollTo != MAX_EID && eid == scrollTo)
|
||||
{
|
||||
ImGui::SetScrollHereY();
|
||||
scrollTo = MAX_EID;
|
||||
}
|
||||
|
||||
auto editor = SHSystemManager::GetSystem<SHEditor>();
|
||||
|
||||
const bool isSelected = (std::ranges::find(editor->selectedEntities, eid) != editor->selectedEntities.end());
|
||||
|
@ -157,7 +182,7 @@ namespace SHADE
|
|||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
|
||||
//Handle node selection
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
|
|
|
@ -23,11 +23,13 @@ namespace SHADE
|
|||
void Init() override;
|
||||
void Update() override;
|
||||
void Exit() override;
|
||||
void SetScrollTo(EntityID eid);
|
||||
private:
|
||||
void DrawMenuBar() const noexcept;
|
||||
ImRect RecursivelyDrawEntityNode(SHSceneNode*);
|
||||
void CreateChildEntity(EntityID parentEID) const noexcept;
|
||||
std::string filter;
|
||||
bool isAnyNodeSelected = false;
|
||||
EntityID scrollTo = MAX_EID;
|
||||
};//class SHHierarchyPanel
|
||||
}//namespace SHADE
|
||||
|
|
|
@ -207,8 +207,10 @@ namespace SHADE
|
|||
auto& colliders = component->GetColliders();
|
||||
int const size = static_cast<int>(colliders.size());
|
||||
ImGui::BeginChild("Colliders", {0.0f, colliders.empty() ? 1.0f : 250.0f}, true);
|
||||
std::optional<int> colliderToDelete{std::nullopt};
|
||||
for (int i{}; i < size; ++i)
|
||||
{
|
||||
ImGui::PushID(i);
|
||||
SHCollider& collider = component->GetCollider(i);
|
||||
auto cursorPos = ImGui::GetCursorPos();
|
||||
|
||||
|
@ -235,9 +237,14 @@ namespace SHADE
|
|||
}
|
||||
if(ImGui::Button(std::format("{} Remove Collider #{}", ICON_MD_REMOVE, i).data()))
|
||||
{
|
||||
component->RemoveCollider(i);
|
||||
colliderToDelete = i;
|
||||
}
|
||||
SHEditorWidgets::EndPanel();
|
||||
ImGui::PopID();
|
||||
}
|
||||
if(colliderToDelete.has_value())
|
||||
{
|
||||
component->RemoveCollider(colliderToDelete.value());
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
|
|
|
@ -99,8 +99,8 @@ namespace SHADE
|
|||
}
|
||||
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void SHEditorInspector::Exit()
|
||||
|
|
|
@ -36,6 +36,11 @@ namespace SHADE
|
|||
void SHEditorMenuBar::Init()
|
||||
{
|
||||
SHEditorWindow::Init();
|
||||
constexpr std::string_view path = "../../Assets/Editor/Layouts";
|
||||
for(auto const& entry : std::filesystem::directory_iterator(path))
|
||||
{
|
||||
layoutPaths.push_back(entry.path());
|
||||
}
|
||||
}
|
||||
|
||||
void SHEditorMenuBar::Update()
|
||||
|
@ -87,20 +92,6 @@ namespace SHADE
|
|||
ImGui::EndDisabled();
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if(ImGui::BeginMenu("Theme"))
|
||||
{
|
||||
auto styles = rttr::type::get<SHEditor::Style>().get_enumeration();
|
||||
auto values = styles.get_values();
|
||||
for (auto style : values)
|
||||
{
|
||||
if(ImGui::Selectable(style.to_string().c_str()))
|
||||
{
|
||||
if(auto editor = SHSystemManager::GetSystem<SHEditor>())
|
||||
editor->SetStyle(style.convert<SHEditor::Style>());
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::BeginMenu("Scripts"))
|
||||
{
|
||||
if (ImGui::Selectable("Generate Visual Studio Project"))
|
||||
|
@ -120,18 +111,79 @@ namespace SHADE
|
|||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Window"))
|
||||
{
|
||||
for (const auto& window : SHEditorWindowManager::editorWindows | std::views::values)
|
||||
{
|
||||
if (window.get() != this)
|
||||
ImGui::Checkbox(window->windowName.data(), &window->isOpen);
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::BeginMenu("Theme"))
|
||||
{
|
||||
const auto styles = rttr::type::get<SHEditor::Style>().get_enumeration();
|
||||
auto values = styles.get_values();
|
||||
for (auto style : values)
|
||||
{
|
||||
if (ImGui::Selectable(style.to_string().c_str()))
|
||||
{
|
||||
if (auto editor = SHSystemManager::GetSystem<SHEditor>())
|
||||
editor->SetStyle(style.convert<SHEditor::Style>());
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if(ImGui::BeginMenu("Layout"))
|
||||
{
|
||||
for(auto const& entry : layoutPaths)
|
||||
{
|
||||
if(ImGui::Selectable(entry.stem().string().c_str()))
|
||||
{
|
||||
ImGui::LoadIniSettingsFromDisk(entry.string().c_str());
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
const ImGuiID dockspace_id = ImGui::GetID("DockSpace");
|
||||
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspaceFlags);
|
||||
const ImGuiID dockspaceId = ImGui::GetID("DockSpace");
|
||||
ImGui::DockSpace(dockspaceId, ImVec2(0.0f, 0.0f), dockspaceFlags);
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
|
||||
void SHEditorMenuBar::DrawSecondaryBar() const noexcept
|
||||
{
|
||||
|
||||
ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||
if(ImGui::BeginViewportSideBar("##SecondaryMenuBar", viewport, ImGuiDir_Up, ImGui::GetFrameHeight(), ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_MenuBar))
|
||||
{
|
||||
ImGui::BeginMenuBar();
|
||||
ImGui::SetCursorPosX(ImGui::GetContentRegionAvail().x * 0.5f - 80.f);
|
||||
const auto editor = SHSystemManager::GetSystem<SHEditor>();
|
||||
ImGui::BeginDisabled(editor->editorState == SHEditor::State::PLAY);
|
||||
if(ImGui::SmallButton(ICON_MD_PLAY_ARROW))
|
||||
{
|
||||
editor->editorState = SHEditor::State::PLAY;
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::BeginDisabled(editor->editorState == SHEditor::State::PAUSE);
|
||||
if(ImGui::SmallButton(ICON_MD_PAUSE))
|
||||
{
|
||||
editor->editorState = SHEditor::State::PAUSE;
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::BeginDisabled(editor->editorState == SHEditor::State::STOP);
|
||||
if(ImGui::SmallButton(ICON_MD_STOP))
|
||||
{
|
||||
editor->editorState = SHEditor::State::STOP;
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void SHEditorMenuBar::DrawStatusBar() const noexcept
|
||||
|
@ -142,8 +194,8 @@ namespace SHADE
|
|||
if (ImGui::BeginViewportSideBar("MainStatusBar", ImGui::GetMainViewport(), ImGuiDir_Down, menuBarHeight, editorMenuBarFlags))
|
||||
{
|
||||
ImGui::Text("Entity count: ");
|
||||
ImGui::End();
|
||||
}
|
||||
ImGui::End();
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,5 +18,6 @@ namespace SHADE
|
|||
void DrawSecondaryBar() const noexcept;
|
||||
void DrawStatusBar() const noexcept;
|
||||
float menuBarHeight = 20.0f;
|
||||
std::vector<std::filesystem::path> layoutPaths;
|
||||
};//class SHEditorMenuBar
|
||||
}//namespace SHADE
|
|
@ -37,8 +37,8 @@ namespace SHADE
|
|||
if(Begin())
|
||||
{
|
||||
ImGui::PlotLines("DT", frames.data(), static_cast<int>(frames.size()), 0, nullptr, 0.0f, 16.0f);
|
||||
ImGui::End();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void SHEditorProfiler::Exit()
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace SHADE
|
|||
//|| Public Member Functions ||
|
||||
//#==============================================================#
|
||||
SHEditorWindow::SHEditorWindow(std::string_view const& name, ImGuiWindowFlags const& inFlags)
|
||||
: isOpen(true), windowName(name), windowFlags(inFlags), io(ImGui::GetIO())
|
||||
: windowName(name), windowFlags(inFlags), io(ImGui::GetIO())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,29 @@ namespace SHADE
|
|||
//#==============================================================#
|
||||
bool SHEditorWindow::Begin()
|
||||
{
|
||||
return ImGui::Begin(windowName.data(), &isOpen, windowFlags);
|
||||
bool result = ImGui::Begin(windowName.data(), &isOpen, windowFlags);
|
||||
|
||||
auto wndSize = ImGui::GetWindowSize();
|
||||
if(windowSize.x != wndSize.x || windowSize.y != wndSize.y)
|
||||
{
|
||||
windowSize = {wndSize.x, wndSize.y};
|
||||
OnResize();
|
||||
}
|
||||
auto wndPos = ImGui::GetWindowPos();
|
||||
if(windowPos.x != wndPos.x || windowPos.y != wndPos.y)
|
||||
{
|
||||
windowPos = {wndPos.x, wndPos.y};
|
||||
OnPosChange();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void SHEditorWindow::OnResize()
|
||||
{
|
||||
}
|
||||
|
||||
void SHEditorWindow::OnPosChange()
|
||||
{
|
||||
}
|
||||
}//namespace SHADE
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
//#==============================================================#
|
||||
#include <string>
|
||||
|
||||
#include "Math/Vector/SHVec2.h"
|
||||
|
||||
//#==============================================================#
|
||||
//|| Forward Declarations ||
|
||||
//#==============================================================#
|
||||
|
@ -21,11 +23,16 @@ namespace SHADE
|
|||
virtual void Init();
|
||||
virtual void Update();
|
||||
virtual void Exit();
|
||||
bool isOpen = false;
|
||||
bool isOpen;
|
||||
std::string_view windowName;
|
||||
protected:
|
||||
virtual bool Begin();
|
||||
virtual void OnResize();
|
||||
virtual void OnPosChange();
|
||||
|
||||
ImGuiWindowFlags windowFlags = 0;
|
||||
ImGuiIO& io;
|
||||
SHVec2 windowSize;
|
||||
SHVec2 windowPos;
|
||||
};//class SHEditorWindow
|
||||
}//namespace SHADE
|
||||
|
|
|
@ -2,4 +2,5 @@
|
|||
#include "MenuBar/SHEditorMenuBar.h" //Menu Bar
|
||||
#include "HierarchyPanel/SHHierarchyPanel.h" //Hierarchy Panel
|
||||
#include "Inspector/SHEditorInspector.h" //Inspector
|
||||
#include "Profiling/SHEditorProfiler.h" //Profiler
|
||||
#include "Profiling/SHEditorProfiler.h" //Profiler
|
||||
#include "ViewportWindow/SHEditorViewport.h" //Editor Viewport
|
|
@ -0,0 +1,60 @@
|
|||
#include "SHpch.h"
|
||||
#include "SHEditorViewport.h"
|
||||
|
||||
#include "ECS_Base/Managers/SHSystemManager.h"
|
||||
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h"
|
||||
#include "Graphics/Descriptors/SHVkDescriptorSetGroup.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
SHEditorViewport::SHEditorViewport()
|
||||
:SHEditorWindow("Viewport", ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoScrollbar)
|
||||
{
|
||||
}
|
||||
|
||||
void SHEditorViewport::Init()
|
||||
{
|
||||
SHEditorWindow::Init();
|
||||
|
||||
}
|
||||
|
||||
void SHEditorViewport::Update()
|
||||
{
|
||||
SHEditorWindow::Update();
|
||||
if(Begin())
|
||||
{
|
||||
DrawMenuBar();
|
||||
auto gfxSystem = SHSystemManager::GetSystem<SHGraphicsSystem>();
|
||||
auto const& descriptorSet = gfxSystem->GetPostOffscreenRenderSystem()->GetDescriptorSetGroup()->GetVkHandle()[0];
|
||||
ImGui::Image((ImTextureID)descriptorSet, ImGui::GetWindowSize());
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void SHEditorViewport::Exit()
|
||||
{
|
||||
SHEditorWindow::Exit();
|
||||
}
|
||||
|
||||
void SHEditorViewport::OnResize()
|
||||
{
|
||||
SHEditorWindow::OnResize();
|
||||
//Get graphics system to resize swapchain image
|
||||
auto gfxSystem = SHSystemManager::GetSystem<SHGraphicsSystem>();
|
||||
|
||||
gfxSystem->PrepareResize(static_cast<uint32_t>(windowSize.x), static_cast<uint32_t>(windowSize.y));
|
||||
}
|
||||
|
||||
void SHEditorViewport::OnPosChange()
|
||||
{
|
||||
SHEditorWindow::OnPosChange();
|
||||
}
|
||||
|
||||
void SHEditorViewport::DrawMenuBar() const noexcept
|
||||
{
|
||||
if(ImGui::BeginMenuBar())
|
||||
{
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
}
|
||||
}//namespace SHADE
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
//#==============================================================#
|
||||
//|| Library Includes ||
|
||||
//#==============================================================#
|
||||
#include <imgui.h>
|
||||
|
||||
//#==============================================================#
|
||||
//|| SHADE Includes ||
|
||||
//#==============================================================#
|
||||
#include "imgui_internal.h"
|
||||
#include "ECS_Base/SHECSMacros.h"
|
||||
#include "Editor/EditorWindow/SHEditorWindow.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
class SHEditorViewport final : public SHEditorWindow
|
||||
{
|
||||
public:
|
||||
SHEditorViewport();
|
||||
void Init() override;
|
||||
void Update() override;
|
||||
void Exit() override;
|
||||
protected:
|
||||
void OnResize() override;
|
||||
void OnPosChange() override;
|
||||
private:
|
||||
void DrawMenuBar() const noexcept;
|
||||
};//class SHEditorViewport
|
||||
}//namespace SHADE
|
|
@ -43,6 +43,8 @@
|
|||
#include <backends/imgui_impl_sdl.h>
|
||||
#include <backends/imgui_impl_vulkan.h>
|
||||
|
||||
#include "Graphics/MiddleEnd/Interface/SHMousePickSystem.h"
|
||||
|
||||
RTTR_REGISTRATION
|
||||
{
|
||||
using namespace SHADE;
|
||||
|
@ -73,6 +75,7 @@ namespace SHADE
|
|||
//#==============================================================#
|
||||
void SHEditor::Init()
|
||||
{
|
||||
|
||||
IMGUI_CHECKVERSION();
|
||||
if(auto context = ImGui::CreateContext())
|
||||
{
|
||||
|
@ -82,11 +85,21 @@ namespace SHADE
|
|||
}
|
||||
}
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO(); (void)io;
|
||||
//Add editor windows
|
||||
SHEditorWindowManager::CreateEditorWindow<SHEditorMenuBar>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHEditorViewport>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHHierarchyPanel>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHEditorInspector>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHEditorProfiler>();
|
||||
|
||||
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; //Enable for Multi-Viewports
|
||||
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; //Enable docking
|
||||
io = &ImGui::GetIO();
|
||||
|
||||
io->ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
||||
io->ConfigFlags |= ImGuiConfigFlags_ViewportsEnable; //Enable for Multi-Viewports
|
||||
io->ConfigFlags |= ImGuiConfigFlags_DockingEnable; //Enable docking
|
||||
io->IniFilename = "../../Assets/Editor/Layouts/UserLayout.ini";
|
||||
|
||||
InitLayout();
|
||||
|
||||
InitFonts();
|
||||
|
||||
|
@ -98,11 +111,11 @@ namespace SHADE
|
|||
|
||||
SetStyle(Style::SHADE);
|
||||
|
||||
//Add editor windows
|
||||
SHEditorWindowManager::CreateEditorWindow<SHEditorMenuBar>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHHierarchyPanel>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHEditorInspector>();
|
||||
SHEditorWindowManager::CreateEditorWindow<SHEditorProfiler>();
|
||||
|
||||
for (const auto& window : SHEditorWindowManager::editorWindows | std::views::values)
|
||||
{
|
||||
window->Init();
|
||||
}
|
||||
|
||||
SHLOG_INFO("Successfully initialised SHADE Engine Editor")
|
||||
}
|
||||
|
@ -116,7 +129,7 @@ namespace SHADE
|
|||
if(window->isOpen)
|
||||
window->Update();
|
||||
}
|
||||
|
||||
|
||||
if(ImGui::IsKeyDown(ImGuiKey_LeftShift) && ImGui::IsKeyDown(ImGuiKey_LeftCtrl) && ImGui::IsKeyReleased(ImGuiKey_Z))
|
||||
{
|
||||
SHCommandManager::RedoCommand();
|
||||
|
@ -125,36 +138,46 @@ namespace SHADE
|
|||
{
|
||||
SHCommandManager::UndoCommand();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Render();
|
||||
}
|
||||
|
||||
void SHEditor::Render()
|
||||
{
|
||||
ImGui::Render();
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
if (io->ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
|
||||
{
|
||||
ImGui::UpdatePlatformWindows();
|
||||
ImGui::RenderPlatformWindowsDefault();
|
||||
}
|
||||
}
|
||||
|
||||
void SHEditor::InitLayout() noexcept
|
||||
{
|
||||
if(!std::filesystem::exists(io->IniFilename))
|
||||
{
|
||||
std::filesystem::copy_file("../../Assets/Editor/Layouts/Default.ini", io->IniFilename);
|
||||
}
|
||||
//eventually load preferred layout here
|
||||
}
|
||||
|
||||
void SHEditor::InitFonts() noexcept
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImFont* mainFont = io.Fonts->AddFontFromFileTTF("../../Assets/Editor/Fonts/Segoe UI.ttf", 20.f);//TODO: Change to config based assets path
|
||||
ImFont* mainFont = io->Fonts->AddFontFromFileTTF("../../Assets/Editor/Fonts/Segoe UI.ttf", 20.f);//TODO: Change to config based assets path
|
||||
|
||||
static const ImWchar icon_ranges[] = { ICON_MIN_MD, ICON_MAX_16_MD, 0 };
|
||||
constexpr ImWchar icon_ranges[] = { ICON_MIN_MD, ICON_MAX_16_MD, 0 };
|
||||
ImFontConfig icons_config{}; icons_config.MergeMode = true; icons_config.GlyphOffset.y = 5.f;
|
||||
ImFont* UIFont = io.Fonts->AddFontFromFileTTF("../../Assets/Editor/Fonts/MaterialIcons-Regular.ttf", 20.f, &icons_config, icon_ranges); //TODO: Change to config based assets path
|
||||
ImFont* UIFont = io->Fonts->AddFontFromFileTTF("../../Assets/Editor/Fonts/MaterialIcons-Regular.ttf", 20.f, &icons_config, icon_ranges); //TODO: Change to config based assets path
|
||||
|
||||
io.Fonts->Build();
|
||||
io->Fonts->Build();
|
||||
}
|
||||
|
||||
void SHEditor::Exit()
|
||||
{
|
||||
for (const auto& window : SHEditorWindowManager::editorWindows | std::views::values)
|
||||
{
|
||||
window->Init();
|
||||
}
|
||||
ImGui_ImplVulkan_Shutdown();
|
||||
ImGui_ImplSDL2_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
|
@ -167,86 +190,86 @@ namespace SHADE
|
|||
default:
|
||||
case Style::SHADE:
|
||||
{
|
||||
ImGuiStyle& imStyle = ImGui::GetStyle();
|
||||
ImVec4* colors = imStyle.Colors;
|
||||
colors[ImGuiCol_Text] = ImVec4(0.706f, 0.729f, 0.757f, 1.00f);
|
||||
colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
|
||||
colors[ImGuiCol_WindowBg] = ImVec4(0.172f, 0.184f, 0.203f, 1.f);
|
||||
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
colors[ImGuiCol_PopupBg] = ImVec4(0.19f, 0.19f, 0.19f, 0.92f);
|
||||
colors[ImGuiCol_Border] = ImVec4(0.19f, 0.19f, 0.19f, 0.29f);
|
||||
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.24f);
|
||||
colors[ImGuiCol_FrameBg] = ImVec4(0.05f, 0.05f, 0.05f, 0.54f);
|
||||
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.19f, 0.19f, 0.19f, 0.54f);
|
||||
colors[ImGuiCol_FrameBgActive] = ImVec4(0.20f, 0.22f, 0.23f, 1.00f);
|
||||
colors[ImGuiCol_TitleBg] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_TitleBgActive] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_TitleBgCollapsed] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_MenuBarBg] = ImVec4(0.129f, 0.141f, 0.157f, 1.f);
|
||||
colors[ImGuiCol_ScrollbarBg] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.34f, 0.34f, 0.34f, 0.54f);
|
||||
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.40f, 0.40f, 0.54f);
|
||||
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.56f, 0.56f, 0.56f, 0.54f);
|
||||
colors[ImGuiCol_CheckMark] = ImVec4(0.627f, 0.239f, 0.761f, 1.00f);
|
||||
colors[ImGuiCol_SliderGrab] = ImVec4(0.34f, 0.34f, 0.34f, 0.54f);
|
||||
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.56f, 0.56f, 0.56f, 0.54f);
|
||||
colors[ImGuiCol_Button] = ImVec4(0.05f, 0.05f, 0.05f, 0.54f);
|
||||
colors[ImGuiCol_ButtonHovered] = ImVec4(0.15f, 0.15f, 0.15f, 0.54f);
|
||||
colors[ImGuiCol_ButtonActive] = ImVec4(0.20f, 0.22f, 0.23f, 1.00f);
|
||||
colors[ImGuiCol_Header] = ImVec4(0.00f, 0.00f, 0.00f, 0.52f);
|
||||
colors[ImGuiCol_HeaderHovered] = ImVec4(0.00f, 0.00f, 0.00f, 0.36f);
|
||||
colors[ImGuiCol_HeaderActive] = ImVec4(0.20f, 0.22f, 0.23f, 0.33f);
|
||||
colors[ImGuiCol_Separator] = colors[ImGuiCol_MenuBarBg];
|
||||
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.44f, 0.44f, 0.44f, 0.29f);
|
||||
colors[ImGuiCol_SeparatorActive] = ImVec4(0.40f, 0.44f, 0.47f, 1.00f);
|
||||
colors[ImGuiCol_ResizeGrip] = ImVec4(0.28f, 0.28f, 0.28f, 0.29f);
|
||||
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.44f, 0.44f, 0.44f, 0.29f);
|
||||
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.40f, 0.44f, 0.47f, 1.00f);
|
||||
colors[ImGuiCol_Tab] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_TabHovered] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);
|
||||
colors[ImGuiCol_TabActive] = ImVec4(0.14f, 0.14f, 0.14f, 0.8f);
|
||||
colors[ImGuiCol_TabUnfocused] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_TabUnfocusedActive] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_DockingPreview] = ImVec4(0.627f, 0.239f, 0.761f, 1.00f);
|
||||
colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.855f, 0.6f, 0.941f, 1.00f);
|
||||
colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_PlotHistogram] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_TableHeaderBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.52f);
|
||||
colors[ImGuiCol_TableBorderStrong] = ImVec4(0.00f, 0.00f, 0.00f, 0.52f);
|
||||
colors[ImGuiCol_TableBorderLight] = ImVec4(0.28f, 0.28f, 0.28f, 0.29f);
|
||||
colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.06f);
|
||||
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.20f, 0.22f, 0.23f, 1.00f);
|
||||
colors[ImGuiCol_DragDropTarget] = ImVec4(0.33f, 0.67f, 0.86f, 1.00f);
|
||||
colors[ImGuiCol_NavHighlight] = ImVec4(0.73f, 0.73f, 0.73f, 0.7f);
|
||||
ImGuiStyle& imStyle = ImGui::GetStyle();
|
||||
ImVec4* colors = imStyle.Colors;
|
||||
colors[ImGuiCol_Text] = ImVec4(0.706f, 0.729f, 0.757f, 1.00f);
|
||||
colors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
|
||||
colors[ImGuiCol_WindowBg] = ImVec4(0.172f, 0.184f, 0.203f, 1.f);
|
||||
colors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
colors[ImGuiCol_PopupBg] = ImVec4(0.19f, 0.19f, 0.19f, 0.92f);
|
||||
colors[ImGuiCol_Border] = ImVec4(0.19f, 0.19f, 0.19f, 0.29f);
|
||||
colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.24f);
|
||||
colors[ImGuiCol_FrameBg] = ImVec4(0.05f, 0.05f, 0.05f, 0.54f);
|
||||
colors[ImGuiCol_FrameBgHovered] = ImVec4(0.19f, 0.19f, 0.19f, 0.54f);
|
||||
colors[ImGuiCol_FrameBgActive] = ImVec4(0.20f, 0.22f, 0.23f, 1.00f);
|
||||
colors[ImGuiCol_TitleBg] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_TitleBgActive] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_TitleBgCollapsed] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_MenuBarBg] = ImVec4(0.129f, 0.141f, 0.157f, 1.f);
|
||||
colors[ImGuiCol_ScrollbarBg] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.34f, 0.34f, 0.34f, 0.54f);
|
||||
colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.40f, 0.40f, 0.54f);
|
||||
colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.56f, 0.56f, 0.56f, 0.54f);
|
||||
colors[ImGuiCol_CheckMark] = ImVec4(0.627f, 0.239f, 0.761f, 1.00f);
|
||||
colors[ImGuiCol_SliderGrab] = ImVec4(0.34f, 0.34f, 0.34f, 0.54f);
|
||||
colors[ImGuiCol_SliderGrabActive] = ImVec4(0.56f, 0.56f, 0.56f, 0.54f);
|
||||
colors[ImGuiCol_Button] = ImVec4(0.05f, 0.05f, 0.05f, 0.54f);
|
||||
colors[ImGuiCol_ButtonHovered] = ImVec4(0.15f, 0.15f, 0.15f, 0.54f);
|
||||
colors[ImGuiCol_ButtonActive] = ImVec4(0.20f, 0.22f, 0.23f, 1.00f);
|
||||
colors[ImGuiCol_Header] = ImVec4(0.00f, 0.00f, 0.00f, 0.52f);
|
||||
colors[ImGuiCol_HeaderHovered] = ImVec4(0.00f, 0.00f, 0.00f, 0.36f);
|
||||
colors[ImGuiCol_HeaderActive] = ImVec4(0.20f, 0.22f, 0.23f, 0.33f);
|
||||
colors[ImGuiCol_Separator] = colors[ImGuiCol_MenuBarBg];
|
||||
colors[ImGuiCol_SeparatorHovered] = ImVec4(0.44f, 0.44f, 0.44f, 0.29f);
|
||||
colors[ImGuiCol_SeparatorActive] = ImVec4(0.40f, 0.44f, 0.47f, 1.00f);
|
||||
colors[ImGuiCol_ResizeGrip] = ImVec4(0.28f, 0.28f, 0.28f, 0.29f);
|
||||
colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.44f, 0.44f, 0.44f, 0.29f);
|
||||
colors[ImGuiCol_ResizeGripActive] = ImVec4(0.40f, 0.44f, 0.47f, 1.00f);
|
||||
colors[ImGuiCol_Tab] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_TabHovered] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);
|
||||
colors[ImGuiCol_TabActive] = ImVec4(0.14f, 0.14f, 0.14f, 0.8f);
|
||||
colors[ImGuiCol_TabUnfocused] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_TabUnfocusedActive] = colors[ImGuiCol_WindowBg];
|
||||
colors[ImGuiCol_DockingPreview] = ImVec4(0.627f, 0.239f, 0.761f, 1.00f);
|
||||
colors[ImGuiCol_DockingEmptyBg] = ImVec4(0.855f, 0.6f, 0.941f, 1.00f);
|
||||
colors[ImGuiCol_PlotLines] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_PlotHistogram] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);
|
||||
colors[ImGuiCol_TableHeaderBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.52f);
|
||||
colors[ImGuiCol_TableBorderStrong] = ImVec4(0.00f, 0.00f, 0.00f, 0.52f);
|
||||
colors[ImGuiCol_TableBorderLight] = ImVec4(0.28f, 0.28f, 0.28f, 0.29f);
|
||||
colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||
colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.06f);
|
||||
colors[ImGuiCol_TextSelectedBg] = ImVec4(0.20f, 0.22f, 0.23f, 1.00f);
|
||||
colors[ImGuiCol_DragDropTarget] = ImVec4(0.33f, 0.67f, 0.86f, 1.00f);
|
||||
colors[ImGuiCol_NavHighlight] = ImVec4(0.73f, 0.73f, 0.73f, 0.7f);
|
||||
colors[ImGuiCol_NavWindowingHighlight] = ImVec4(0.141f, 0.141f, 0.141f, 0.70f);
|
||||
colors[ImGuiCol_NavWindowingDimBg] = colors[ImGuiCol_NavHighlight];
|
||||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.2f, 0.2f, 0.2f, 0.65f);
|
||||
colors[ImGuiCol_NavWindowingDimBg] = colors[ImGuiCol_NavHighlight];
|
||||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.2f, 0.2f, 0.2f, 0.65f);
|
||||
|
||||
imStyle.WindowPadding = ImVec2(8.00f, 8.00f);
|
||||
imStyle.FramePadding = ImVec2(5.00f, 2.00f);
|
||||
imStyle.CellPadding = ImVec2(6.00f, 8.00f);
|
||||
imStyle.ItemSpacing = ImVec2(6.00f, 6.00f);
|
||||
imStyle.ItemInnerSpacing = ImVec2(6.00f, 6.00f);
|
||||
imStyle.TouchExtraPadding = ImVec2(0.00f, 0.00f);
|
||||
imStyle.IndentSpacing = 25;
|
||||
imStyle.ScrollbarSize = 15;
|
||||
imStyle.GrabMinSize = 10;
|
||||
imStyle.WindowBorderSize = 0.6f;
|
||||
imStyle.ChildBorderSize = 1;
|
||||
imStyle.PopupBorderSize = 1;
|
||||
imStyle.FrameBorderSize = 1;
|
||||
imStyle.TabBorderSize = 1;
|
||||
imStyle.WindowRounding = 7;
|
||||
imStyle.ChildRounding = 4;
|
||||
imStyle.FrameRounding = 3;
|
||||
imStyle.PopupRounding = 4;
|
||||
imStyle.ScrollbarRounding = 9;
|
||||
imStyle.GrabRounding = 3;
|
||||
imStyle.LogSliderDeadzone = 4;
|
||||
imStyle.TabRounding = 4;
|
||||
imStyle.WindowPadding = ImVec2(8.00f, 8.00f);
|
||||
imStyle.FramePadding = ImVec2(5.00f, 2.00f);
|
||||
imStyle.CellPadding = ImVec2(6.00f, 8.00f);
|
||||
imStyle.ItemSpacing = ImVec2(6.00f, 6.00f);
|
||||
imStyle.ItemInnerSpacing = ImVec2(6.00f, 6.00f);
|
||||
imStyle.TouchExtraPadding = ImVec2(0.00f, 0.00f);
|
||||
imStyle.IndentSpacing = 25;
|
||||
imStyle.ScrollbarSize = 15;
|
||||
imStyle.GrabMinSize = 10;
|
||||
imStyle.WindowBorderSize = 0.6f;
|
||||
imStyle.ChildBorderSize = 1;
|
||||
imStyle.PopupBorderSize = 1;
|
||||
imStyle.FrameBorderSize = 1;
|
||||
imStyle.TabBorderSize = 1;
|
||||
imStyle.WindowRounding = 7;
|
||||
imStyle.ChildRounding = 4;
|
||||
imStyle.FrameRounding = 3;
|
||||
imStyle.PopupRounding = 4;
|
||||
imStyle.ScrollbarRounding = 9;
|
||||
imStyle.GrabRounding = 3;
|
||||
imStyle.LogSliderDeadzone = 4;
|
||||
imStyle.TabRounding = 4;
|
||||
imStyle.WindowMenuButtonPosition = ImGuiDir_None;
|
||||
}
|
||||
break;
|
||||
|
@ -281,10 +304,11 @@ namespace SHADE
|
|||
imguiCommandPool = gfxSystem->GetDevice()->CreateCommandPool(SH_QUEUE_FAMILY_ARRAY_INDEX::GRAPHICS, SH_CMD_POOL_RESET::POOL_BASED, true);
|
||||
imguiCommandBuffer = imguiCommandPool->RequestCommandBuffer(SH_CMD_BUFFER_TYPE::PRIMARY);
|
||||
|
||||
auto const& renderers = gfxSystem->GetDefaultViewport()->GetRenderers();
|
||||
//auto const& renderers = gfxSystem->GetDefaultViewport()->GetRenderers();
|
||||
auto const& renderers = gfxSystem->GetEditorViewport()->GetRenderers();
|
||||
|
||||
SHASSERT(!renderers.empty(), "No Renderers available")
|
||||
auto renderGraph = renderers[0]->GetRenderGraph();
|
||||
auto renderGraph = renderers[SHGraphicsConstants::RenderGraphIndices::EDITOR]->GetRenderGraph();
|
||||
auto renderPass = renderGraph->GetNode("ImGui Node")->GetRenderpass();
|
||||
|
||||
if(ImGui_ImplVulkan_Init(&initInfo, renderPass->GetVkRenderpass()) == false)
|
||||
|
@ -309,6 +333,28 @@ namespace SHADE
|
|||
});
|
||||
}
|
||||
|
||||
void SHEditor::PollPicking()
|
||||
{
|
||||
if (auto gfxSystem = SHSystemManager::GetSystem<SHGraphicsSystem>())
|
||||
{
|
||||
if (!ImGui::IsAnyItemHovered() && ImGui::IsMouseReleased(ImGuiMouseButton_Left))
|
||||
{
|
||||
EntityID pickedEID = gfxSystem->GetMousePickSystem()->GetPickedEntity();
|
||||
if(pickedEID == MAX_EID)
|
||||
return;
|
||||
if (!ImGui::IsKeyDown(ImGuiKey_LeftCtrl))
|
||||
{
|
||||
if (const auto hierarchyPanel = SHEditorWindowManager::GetEditorWindow<SHHierarchyPanel>())
|
||||
{
|
||||
hierarchyPanel->SetScrollTo(pickedEID);
|
||||
}
|
||||
selectedEntities.clear();
|
||||
}
|
||||
selectedEntities.push_back(pickedEID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SHEditor::NewFrame()
|
||||
{
|
||||
SDL_Event event;
|
||||
|
|
|
@ -90,11 +90,11 @@ namespace SHADE
|
|||
return reinterpret_cast<T*>(editorWindows[GetEditorWindowID<T>()].get());
|
||||
}
|
||||
|
||||
static EditorWindowMap editorWindows;
|
||||
private:
|
||||
// Number of windows; used for Editor Window ID Generation
|
||||
static EditorWindowID windowCount;
|
||||
// Map of Editor Windows
|
||||
static EditorWindowMap editorWindows;
|
||||
friend class SHEditor;
|
||||
};
|
||||
|
||||
|
@ -110,10 +110,17 @@ namespace SHADE
|
|||
class SH_API EditorRoutine final : public SHSystemRoutine
|
||||
{
|
||||
public:
|
||||
EditorRoutine() = default;
|
||||
EditorRoutine():SHSystemRoutine("Editor routine", true) {};
|
||||
void Execute(double dt) noexcept override final;
|
||||
};
|
||||
|
||||
enum class State : uint8_t
|
||||
{
|
||||
PLAY,
|
||||
PAUSE,
|
||||
STOP
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Style options
|
||||
*
|
||||
|
@ -162,9 +169,13 @@ namespace SHADE
|
|||
|
||||
void SetSDLWindow(SDL_Window* inSDLWindow){sdlWindow = inSDLWindow;};
|
||||
|
||||
void PollPicking();
|
||||
|
||||
// List of selected entities
|
||||
std::vector<EntityID> selectedEntities;
|
||||
|
||||
State editorState = State::STOP;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Start new frame for editor
|
||||
|
@ -177,7 +188,7 @@ namespace SHADE
|
|||
*/
|
||||
void Render();
|
||||
|
||||
|
||||
void InitLayout() noexcept;
|
||||
|
||||
void InitFonts() noexcept;
|
||||
|
||||
|
@ -186,6 +197,8 @@ namespace SHADE
|
|||
// Handle to command buffer used for ImGui Vulkan Backend
|
||||
Handle<SHVkCommandBuffer> imguiCommandBuffer;
|
||||
|
||||
SDL_Window* sdlWindow;
|
||||
SDL_Window* sdlWindow {nullptr};
|
||||
|
||||
ImGuiIO* io{nullptr};
|
||||
};//class SHEditor
|
||||
}//namespace SHADE
|
||||
|
|
Loading…
Reference in New Issue