66 static void SetInstance(
EngineCore& engineCore);
69 bool isEditor =
false;
70 const char* applicationModuleName =
nullptr;
71 const char* applicationTitle =
nullptr;
72 const char* projectPath =
nullptr;
73 const char* engineBinaryPath =
nullptr;
84 virtual void InitializeScene(
bool shouldLoadSceneFromDefaults,
const char* scenePath =
nullptr);
85 virtual void ShowMainWindow();
89 virtual void RunEditorLoopIteration();
90 virtual void RunLoopIteration();
91 virtual void UpdateWindows();
105 virtual std::filesystem::path GetProjectPath()
const;
106 virtual std::filesystem::path GetBinaryPath()
const;
107 virtual std::filesystem::path GetEngineBinaryPath()
const;
108 virtual std::filesystem::path GetAssetsPath()
const;
109 virtual std::filesystem::path GetEngineAssetsPath()
const;
110 virtual std::filesystem::path GetAssetPath(std::string subPath)
const;
111 virtual entt::registry& GetEntityRegistry();
116 virtual void CalculateDeltaTime();
117 virtual double GetTimeSinceLaunch()
const;
118 virtual double GetDeltaTime()
const;
119 virtual void PushDeletion(std::function<
void()> fn);
120 virtual void ForceDeleteAllDeferred();
122 template<
typename T,
typename... Args>
123 void RegisterServiceEmplaced(Args&&... params) {
124 const size_t hash =
typeid(T).hash_code();
125 auto it = services.find(hash);
126 if (it == services.end()) {
127 services[hash] = Grindstone::Memory::AllocatorCore::Allocate<T>(std::forward<Args>(params)...);
132 void RegisterService(T* instance) {
133 const size_t hash =
typeid(T).hash_code();
134 auto it = services.find(hash);
135 if (it == services.end()) {
136 services.emplace(hash, instance);
141 void UnregisterService() {
142 const size_t hash =
typeid(T).hash_code();
143 auto it = services.find(hash);
144 if (it == services.end()) {
151 const size_t hash =
typeid(T).hash_code();
152 auto it = services.find(hash);
153 return (it != services.end())
154 ?
static_cast<T*
>(it->second)
158 DisplayManager* displayManager =
nullptr;
159 WindowManager* windowManager =
nullptr;
160 Assets::AssetManager* assetManager =
nullptr;
161 AssetRendererManager* assetRendererManager =
nullptr;
162 WorldContextManager* worldContextManager =
nullptr;
163 Profiler::Manager* profiler =
nullptr;
164 bool isEditor =
false;
166 Grindstone::DeferredDeletionQueue deferredDeletionQueue;
167 double currentTime = 0.0;
168 double deltaTime = 0.0;
169 std::chrono::steady_clock::time_point firstFrameTime;
170 std::chrono::steady_clock::time_point lastFrameTime;
171 SceneManagement::SceneManager* sceneManager =
nullptr;
172 ECS::ComponentRegistrar* componentRegistrar =
nullptr;
173 ECS::SystemRegistrar* systemRegistrar =
nullptr;
174 RenderPassRegistry* renderpassRegistry =
nullptr;
175 Events::Dispatcher* eventDispatcher =
nullptr;
176 Plugins::Interface* pluginInterface =
nullptr;
177 Plugins::IPluginManager* pluginManager =
nullptr;
178 Renderer::RenderingPipeline* renderingPipeline =
nullptr;
179 GraphicsAPI::Core* graphicsCore =
nullptr;
180 Input::Interface* inputManager =
nullptr;
181 std::unordered_map<std::size_t, void*> services;
182 bool shouldClose =
false;
183 std::filesystem::path projectPath;
184 std::filesystem::path binaryPath;
185 std::filesystem::path engineBinaryPath;
186 std::filesystem::path engineAssetsPath;
187 std::filesystem::path assetsPath;
Definition WorldContextManager.hpp:12