Editor Refactor
This refactor of the editor code makes the code more maintainable. All widget objects have now moved away from RAII and are now just allocated object that live for the entirety of the applications lifetime. This feels better as I am used to this style plus constantly pushing and popping objects from the stack seems a little wasteful (although I as of right now have no way to prove that it is ).
This commit is contained in:
26
Editor/src/EditorWindow.h
Normal file
26
Editor/src/EditorWindow.h
Normal file
@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <imgui.h>
|
||||
#include <string>
|
||||
|
||||
class EditorWindow {
|
||||
|
||||
public:
|
||||
EditorWindow (const std::string& name, ImGuiWindowFlags_ flags = ImGuiWindowFlags_None ) : name(name) , flags(flags) {}
|
||||
|
||||
void Update()
|
||||
{
|
||||
ImGui::Begin(name.c_str(), false, flags);
|
||||
Draw();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
~EditorWindow() = default;
|
||||
|
||||
protected:
|
||||
std::string name;
|
||||
|
||||
private:
|
||||
ImGuiWindowFlags_ flags;
|
||||
|
||||
virtual void Draw() = 0;
|
||||
};
|
Reference in New Issue
Block a user