added editor WIP

This commit is contained in:
2026-01-18 14:59:44 +01:00
parent 281e4740a8
commit dc5b58d7d3
27 changed files with 2448 additions and 1 deletions

View File

@@ -0,0 +1,35 @@
#include "GuiWindow.h"
TSE::EDITOR::GuiWindow::GuiWindow(const string &title, const ImGuiWindowFlags &flags)
{
this->title = title;
this->flags = flags;
}
TSE::EDITOR::GuiWindow::GuiWindow(const string &title, const Vector2 pos, const Vector2 size, const ImGuiWindowFlags &flags)
{
this->title = title;
this->pos = pos;
this->size = size;
this->flags = flags;
}
void TSE::EDITOR::GuiWindow::Render()
{
if(enabled)
{
Begin();
Define();
End();
}
}
void TSE::EDITOR::GuiWindow::Begin()
{
ImGui::Begin(title.c_str(), &enabled, flags);
}
void TSE::EDITOR::GuiWindow::End()
{
ImGui::End();
}

View File

@@ -0,0 +1,27 @@
#pragma once
#include "IGUIElement.hpp"
#include "Types.hpp"
#include "Vector2.hpp"
#include "imgui/imgui.h"
namespace TSE::EDITOR
{
class GuiWindow : public IGUIElement
{
public:
Vector2 pos = Vector2::zero;
Vector2 size = Vector2(100,100);
ImGuiWindowFlags flags = ImGuiWindowFlags_None;
string title = "Title";
GuiWindow(const string& title, const ImGuiWindowFlags& flags = ImGuiWindowFlags_None);
GuiWindow(const string& title, const Vector2 pos, const Vector2 size, const ImGuiWindowFlags& flags = ImGuiWindowFlags_None);
void Render() override;
virtual void Define() = 0;
private:
void Begin();
void End();
};
} // namespace TSE::EDITOR

View File

@@ -0,0 +1,16 @@
#pragma once
namespace TSE::EDITOR
{
class IGUIElement
{
protected:
bool enabled = true;
public:
virtual void Render() = 0;
inline void SetEnabled(bool state)
{
enabled = state;
};
};
} // namespace TSE::EDITOR