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

View File

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