Grindstone Game Engine
v0.2.0
An open source game engine and toolkit.
Toggle main menu visibility
Loading...
Searching...
No Matches
EngineCore.hpp
1
#pragma once
2
3
#include <filesystem>
4
#include <functional>
5
#include <chrono>
6
7
#include <entt/entity/registry.hpp>
8
9
#include <EngineCore/Utils/DeferredDeletionQueue.hpp>
10
#include <Common/Logging.hpp>
11
12
namespace
Grindstone {
13
namespace
GraphicsAPI {
14
class
Core
;
15
class
RenderPass
;
16
}
17
18
namespace
Input {
19
class
Interface
;
20
}
21
22
namespace
Plugins {
23
class
IPluginManager
;
24
class
Interface
;
25
}
26
27
namespace
ECS {
28
class
ComponentRegistrar
;
29
class
SystemRegistrar
;
30
}
31
32
namespace
SceneManagement {
33
class
SceneManager
;
34
}
35
36
namespace
Events {
37
struct
BaseEvent
;
38
class
Dispatcher
;
39
}
40
41
namespace
Assets {
42
class
AssetManager
;
43
class
AssetLoader
;
44
}
45
46
namespace
Profiler {
47
class
Manager
;
48
}
49
50
class
Window
;
51
class
DisplayManager
;
52
class
WindowManager
;
53
54
class
AssetRendererManager
;
55
class
BaseRendererFactory
;
56
class
RenderPassRegistry
;
57
class
WorldContextManager
;
58
59
class
EngineCore
{
60
public
:
61
static
EngineCore
& GetInstance();
62
static
void
SetInstance(
EngineCore
& engineCore);
63
64
struct
EarlyCreateInfo
{
65
bool
isEditor =
false
;
66
const
char
* applicationModuleName =
nullptr
;
67
const
char
* applicationTitle =
nullptr
;
68
const
char
* projectPath =
nullptr
;
69
const
char
* engineBinaryPath =
nullptr
;
70
Assets::AssetLoader
* assetLoader =
nullptr
;
71
};
72
73
struct
LateCreateInfo
{
74
Grindstone::Assets::AssetLoader
* assetLoader =
nullptr
;
75
Grindstone::Plugins::IPluginManager
* pluginManagerOverride =
nullptr
;
76
};
77
78
virtual
bool
EarlyInitialize(
EarlyCreateInfo
& ci);
79
virtual
bool
Initialize(
LateCreateInfo
& createInfo);
80
virtual
void
InitializeScene(
bool
shouldLoadSceneFromDefaults,
const
char
* scenePath =
nullptr
);
81
virtual
void
ShowMainWindow();
82
83
virtual
~EngineCore
();
84
virtual
void
Run();
85
virtual
void
RunEditorLoopIteration();
86
virtual
void
RunLoopIteration();
87
virtual
void
UpdateWindows();
88
void
RegisterGraphicsCore(
GraphicsAPI::Core
*);
89
virtual
void
RegisterInputManager(
Input::Interface
*);
90
virtual
void
SetRendererFactory(
BaseRendererFactory
* factory);
91
virtual
Input::Interface
* GetInputManager()
const
;
92
virtual
SceneManagement::SceneManager
* GetSceneManager()
const
;
93
virtual
Plugins::IPluginManager
* GetPluginManager()
const
;
94
virtual
Plugins::Interface
* GetPluginInterface()
const
;
95
virtual
ECS::SystemRegistrar
* GetSystemRegistrar()
const
;
96
virtual
Events::Dispatcher
* GetEventDispatcher()
const
;
97
virtual
ECS::ComponentRegistrar
* GetComponentRegistrar()
const
;
98
virtual
GraphicsAPI::Core
* GetGraphicsCore()
const
;
99
virtual
Profiler::Manager
* GetProfiler()
const
;
100
virtual
BaseRendererFactory
* GetRendererFactory()
const
;
101
virtual
RenderPassRegistry
* GetRenderPassRegistry()
const
;
102
virtual
WorldContextManager
* GetWorldContextManager()
const
;
103
virtual
std::filesystem::path GetProjectPath()
const
;
104
virtual
std::filesystem::path GetBinaryPath()
const
;
105
virtual
std::filesystem::path GetEngineBinaryPath()
const
;
106
virtual
std::filesystem::path GetAssetsPath()
const
;
107
virtual
std::filesystem::path GetEngineAssetsPath()
const
;
108
virtual
std::filesystem::path GetAssetPath(std::string subPath)
const
;
109
virtual
entt::registry& GetEntityRegistry();
110
virtual
void
ReloadCsharpBinaries();
111
112
virtual
bool
OnTryQuit(
Grindstone::Events::BaseEvent
* ev);
113
virtual
bool
OnForceQuit(
Grindstone::Events::BaseEvent
* ev);
114
virtual
void
CalculateDeltaTime();
115
virtual
double
GetTimeSinceLaunch()
const
;
116
virtual
double
GetDeltaTime()
const
;
117
virtual
void
PushDeletion(std::function<
void
()> fn);
118
public
:
119
DisplayManager
* displayManager =
nullptr
;
120
WindowManager
* windowManager =
nullptr
;
121
Assets::AssetManager
* assetManager =
nullptr
;
122
AssetRendererManager
* assetRendererManager =
nullptr
;
123
WorldContextManager
* worldContextManager =
nullptr
;
124
Profiler::Manager
* profiler =
nullptr
;
125
void
* scriptManager =
nullptr
;
126
std::function<void()> callbackReloadCsharp;
127
bool
isEditor =
false
;
128
private
:
129
Grindstone::DeferredDeletionQueue
deferredDeletionQueue;
130
double
currentTime = 0.0;
131
double
deltaTime = 0.0;
132
std::chrono::steady_clock::time_point firstFrameTime;
133
std::chrono::steady_clock::time_point lastFrameTime;
134
SceneManagement::SceneManager
* sceneManager =
nullptr
;
135
ECS::ComponentRegistrar
* componentRegistrar =
nullptr
;
136
ECS::SystemRegistrar
* systemRegistrar =
nullptr
;
137
BaseRendererFactory
* rendererFactory =
nullptr
;
138
RenderPassRegistry
* renderpassRegistry =
nullptr
;
139
Events::Dispatcher
* eventDispatcher =
nullptr
;
140
Plugins::Interface
* pluginInterface =
nullptr
;
141
Plugins::IPluginManager
* pluginManager =
nullptr
;
142
GraphicsAPI::Core
* graphicsCore =
nullptr
;
143
Input::Interface
* inputManager =
nullptr
;
144
bool
shouldClose =
false
;
145
std::filesystem::path projectPath;
146
std::filesystem::path binaryPath;
147
std::filesystem::path engineBinaryPath;
148
std::filesystem::path engineAssetsPath;
149
std::filesystem::path assetsPath;
150
};
151
}
Grindstone::AssetRendererManager
Definition
AssetRendererManager.hpp:18
Grindstone::Assets::AssetLoader
Definition
AssetLoader.hpp:32
Grindstone::Assets::AssetManager
Definition
AssetManager.hpp:15
Grindstone::BaseRendererFactory
Definition
BaseRenderer.hpp:47
Grindstone::DeferredDeletionQueue
Definition
DeferredDeletionQueue.hpp:17
Grindstone::DisplayManager
Definition
DisplayManager.hpp:8
Grindstone::ECS::ComponentRegistrar
Definition
ComponentRegistrar.hpp:18
Grindstone::ECS::SystemRegistrar
Definition
SystemRegistrar.hpp:12
Grindstone::EngineCore
Definition
EngineCore.hpp:59
Grindstone::Events::Dispatcher
Definition
Dispatcher.hpp:14
Grindstone::GraphicsAPI::Core
Definition
Core.hpp:41
Grindstone::GraphicsAPI::RenderPass
Definition
RenderPass.hpp:10
Grindstone::Input::Interface
Definition
InputInterface.hpp:11
Grindstone::Plugins::IPluginManager
Definition
IPluginManager.hpp:9
Grindstone::Plugins::Interface
Definition
Interface.hpp:48
Grindstone::Profiler::Manager
Definition
Profiling.hpp:24
Grindstone::RenderPassRegistry
Definition
RenderPassRegistry.hpp:12
Grindstone::SceneManagement::SceneManager
Definition
Manager.hpp:11
Grindstone::WindowManager
Definition
WindowManager.hpp:7
Grindstone::Window
Definition
Window.hpp:12
Grindstone::WorldContextManager
Definition
WorldContextManager.hpp:12
Grindstone::EngineCore::EarlyCreateInfo
Definition
EngineCore.hpp:64
Grindstone::EngineCore::LateCreateInfo
Definition
EngineCore.hpp:73
Grindstone::Events::BaseEvent
Definition
BaseEvent.hpp:7
sources
code
EngineCore
EngineCore.hpp
Generated by
1.17.0