Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
EditorManager.hpp
1#pragma once
2
3#include "pch.hpp"
4
5#include <entt/entt.hpp>
6#include <Common/Logging.hpp>
7#include <Common/Utilities/ModuleLoading.hpp>
8
9#include "EngineCore/EngineCore.hpp"
10#include "Commands/CommandList.hpp"
11#include "Importers/ImporterManager.hpp"
12#include "ScriptBuilder/CSharpBuildManager.hpp"
13#include "AssetTemplateRegistry.hpp"
14#include "FileManager.hpp"
15#include "AssetRegistry.hpp"
16#include "GitManager.hpp"
17#include "Selection.hpp"
18#include "TaskSystem.hpp"
19
20namespace Grindstone {
21 class WorldContextSet;
22}
23
24namespace Grindstone::Events {
25 struct BaseEvent;
26}
27
28namespace Grindstone::Editor {
29 class IEditor;
30
31 namespace ImguiEditor {
32 class ImguiEditor;
33 }
34
35 enum class ManipulationMode {
36 Translate,
37 Rotate,
38 Scale
39 };
40
41 enum class PlayMode {
42 Editor,
43 Play,
44 Pause
45 };
46
47 class Manager {
48 public:
49 Manager() = default;
50 static Manager& GetInstance();
51 static void SetInstance(Grindstone::Editor::Manager* editorManager);
52 Grindstone::Importers::ImporterManager& GetImporterManager();
53 ImguiEditor::ImguiEditor& GetImguiEditor();
54 virtual AssetRegistry& GetAssetRegistry();
55 virtual CommandList& GetCommandList();
56 virtual GitManager& GetGitManager();
57 virtual Selection& GetSelection();
58 virtual TaskSystem& GetTaskSystem();
59 virtual AssetTemplateRegistry& GetAssetTemplateRegistry();
60 ScriptBuilder::CSharpBuildManager& GetCSharpBuildManager();
61 static FileManager& GetFileManager();
62 static EngineCore& GetEngineCore();
63 bool Initialize(std::filesystem::path projectPath);
64 void InitializeQuitCommands();
65 ~Manager();
66 void Run();
67 // Begin to set PlayMode at end of frame.
68 void SetPlayMode(PlayMode newPlayMode);
69 PlayMode GetPlayMode() const;
70 const std::filesystem::path& GetProjectPath() const;
71 const std::filesystem::path& GetAssetsPath() const;
72 const std::filesystem::path& GetCompiledAssetsPath() const;
73 const std::filesystem::path& GetEngineBinariesPath() const;
74 bool OnKeyPress(Grindstone::Events::BaseEvent* ev);
75 bool OnTryQuit(Grindstone::Events::BaseEvent* ev);
76 bool OnForceQuit(Grindstone::Events::BaseEvent* ev);
77 ManipulationMode manipulationMode = ManipulationMode::Translate;
78 bool isManipulatingInWorldSpace = false;
79 private:
80 bool LoadEngine();
81 bool SetupImguiEditor();
82
83 // Actually change the PlayMode, to be used only by SetPlayMode.
84 void TransferPlayMode(PlayMode newPlayMode);
85 private:
86 std::filesystem::path projectPath;
87 std::filesystem::path assetsPath;
88 std::filesystem::path compiledAssetsPath;
89 std::filesystem::path engineBinariesPath;
90 bool shouldClose = false;
91 EngineCore* engineCore = nullptr;
92 ImguiEditor::ImguiEditor* imguiEditor = nullptr;
93 ScriptBuilder::CSharpBuildManager csharpBuildManager;
94 CommandList commandList;
95 // Current PlayMode - should we update objects? And how?
96 PlayMode playMode = PlayMode::Editor;
97 // Play Mode that will be set at end of frame
98 PlayMode newPlayMode = PlayMode::Editor;
99 Selection selection;
100 FileManager fileManager;
101 TaskSystem taskSystem;
102 AssetRegistry assetRegistry;
103 GitManager gitManager;
104 AssetTemplateRegistry assetTemplateRegistry;
105 Grindstone::Utilities::Modules::Handle engineCoreLibraryHandle;
107 Grindstone::WorldContextSet* runtimeWorldContext = nullptr;
108 Grindstone::WorldContextSet* editorWorldContext = nullptr;
109 };
110}
Definition AssetRegistry.hpp:15
Definition AssetTemplateRegistry.hpp:10
Definition CommandList.hpp:20
Definition FileManager.hpp:8
Definition GitManager.hpp:15
Definition IEditor.hpp:7
Definition EditorManager.hpp:47
Definition Selection.hpp:10
Definition TaskSystem.hpp:30
Definition EngineCore.hpp:58
Definition ImporterManager.hpp:13
Definition WorldContextSet.hpp:11
Definition BaseEvent.hpp:7