Refactor EditorContext and system managers for improved clarity and consistency

This commit is contained in:
scawful
2024-11-20 09:52:54 -05:00
parent 21314702e8
commit 2deb0050be
3 changed files with 16 additions and 13 deletions

View File

@@ -20,11 +20,11 @@ namespace app {
namespace editor {
struct EditorContext {
static ConstantManager constant_manager;
static CommandManager command_manager;
static ExtensionManager extension_manager;
static HistoryManager history_manager;
static ResourceManager resource_manager;
ConstantManager constant_manager;
CommandManager command_manager;
ExtensionManager extension_manager;
HistoryManager history_manager;
ResourceManager resource_manager;
};
enum class EditorType {
@@ -52,7 +52,7 @@ constexpr std::array<const char *, 10> kEditorNames = {
* Provides basic editing operations that each editor should implement.
*/
class Editor {
public:
public:
Editor() = default;
virtual ~Editor() = default;
@@ -69,7 +69,7 @@ public:
EditorType type() const { return type_; }
protected:
protected:
EditorType type_;
EditorContext context_;
};
@@ -98,8 +98,8 @@ typedef struct EditorLayoutParams {
absl::Status DrawEditor(EditorLayoutParams *params);
} // namespace editor
} // namespace app
} // namespace yaze
} // namespace editor
} // namespace app
} // namespace yaze
#endif // YAZE_APP_CORE_EDITOR_H
#endif // YAZE_APP_CORE_EDITOR_H

View File

@@ -15,6 +15,9 @@ ImGuiKey MapKeyToImGuiKey(char key);
class CommandManager {
public:
CommandManager() = default;
~CommandManager() = default;
using Command = std::function<void()>;
struct CommandInfo {

View File

@@ -10,8 +10,8 @@ namespace editor {
// System resource manager.
class ResourceManager {
public:
ResourceManager();
~ResourceManager();
ResourceManager() : count_(0) {}
~ResourceManager() = default;
void Load(const char* path);
void Unload(const char* path);