Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
Interface.hpp
1#pragma once
2
3#include "../pch.hpp"
4
5#include <cstdint>
6#include <functional>
7
8#include <Common/Display/Display.hpp>
9#include <Common/Graphics/Core.hpp>
10#include <Common/Logging.hpp>
11#include <Common/ResourcePipeline/AssetType.hpp>
12#include <Common/Window/Window.hpp>
13#include <EngineCore/AssetRenderer/BaseAssetRenderer.hpp>
14#include <EngineCore/Assets/AssetImporter.hpp>
15#include <EngineCore/ECS/ComponentFunctions.hpp>
16#include <EngineCore/ECS/ComponentRegistrar.hpp>
17#include <EngineCore/ECS/SystemFactory.hpp>
18#include <EngineCore/ECS/SystemRegistrar.hpp>
19#include <EngineCore/Logger.hpp>
20#include <EngineCore/WorldContext/WorldContext.hpp>
21
22namespace Grindstone {
24 struct AllocatorState;
25 }
26
27 namespace GraphicsAPI {
28 class Core;
29 }
30
31 namespace ECS {
32 class SystemRegistrar;
33 }
34
35 namespace Rendering {
36 class RendererFeature;
37 }
38
39 class CvarSystem;
40 class WindowManager;
41 class DisplayManager;
43
44 namespace Plugins {
45 class Manager;
46
48 public:
49 virtual ~IEditorInterface() {}
50 };
51
52 namespace Rendering {
53 class RendererFeature;
54 }
55
56 class ENGINE_CORE_API Interface {
57 public:
58 virtual void SetEditorInterface(Grindstone::Plugins::IEditorInterface* editorInterface);
59 virtual Grindstone::Plugins::IEditorInterface* GetEditorInterface() const;
60
61 virtual EngineCore* GetEngineCore();
62 virtual GraphicsAPI::Core* GetGraphicsCore();
63 virtual void RegisterGraphicsCore(Grindstone::GraphicsAPI::Core* core);
64 virtual void RegisterWindowManager(Grindstone::WindowManager*);
65 virtual void RegisterDisplayManager(Grindstone::DisplayManager*);
66 virtual Window* CreateDisplayWindow(Window::CreateInfo&);
67 virtual Display GetMainDisplay();
68 virtual uint8_t CountDisplays();
69 virtual void EnumerateDisplays(Display* displays);
70 virtual void RegisterSystem(const char* name, ECS::SystemFactory factory);
71 virtual void RegisterEditorSystem(const char* name, ECS::SystemFactory factory);
72 virtual void UnregisterSystem(const char* name);
73 virtual void UnregisterEditorSystem(const char* name);
74 virtual void RegisterAssetRenderer(BaseAssetRenderer* assetRenderer);
75 virtual void UnregisterAssetRenderer(BaseAssetRenderer* assetRenderer);
76 virtual void RegisterAssetType(AssetType assetType, const char* typeName, AssetImporter* assetImporter);
77 virtual void UnregisterAssetType(AssetType assetType);
78 virtual Grindstone::HashedString::HashMap* GetHashedStringMap() const;
79 virtual Grindstone::Logger::LoggerState* GetLoggerState() const;
80 virtual Grindstone::Memory::AllocatorCore::AllocatorState* GetAllocatorState() const;
81 virtual Grindstone::CvarSystem* GetCvarSystem() const;
82 virtual void RegisterWorldContextFactory(Grindstone::HashedString contextName, Grindstone::UniquePtr<Grindstone::WorldContext> (*FactoryFn)());
83 virtual void UnregisterWorldContextFactory(Grindstone::HashedString contextName);
84 virtual void RegisterRendererFeature(Grindstone::Rendering::RendererFeature* feature);
85 virtual void UnregisterRendererFeature(const char* name);
86
87 template<typename ClassType>
88 void RegisterWorldContextFactory(Grindstone::HashedString contextName) {
89 RegisterWorldContextFactory(contextName, Grindstone::WorldContext::Create<ClassType>);
90 }
91
92 template<typename ClassType>
93 void RegisterComponent() {
94 componentRegistrar->RegisterComponent<ClassType>();
95 }
96
97 template<typename T>
98 void UnregisterComponent() {
99 componentRegistrar->UnregisterComponent<T>();
100 }
101
102 template<typename ClassType>
103 void RegisterRendererFeature() {
104 RegisterRendererFeature(Grindstone::Memory::AllocatorCore::Allocate<ClassType>());
105 }
106
107 template<typename ClassType>
108 void UnregisterRendererFeature() {
109 UnregisterRendererFeature(ClassType::GetStaticFeatureName());
110 }
111
112 template<typename Asset>
113 void RegisterAssetType(AssetImporter* assetImporter) {
114 RegisterAssetType(Asset::GetStaticType(), Asset::GetStaticTypeName().c_str(), assetImporter);
115 }
116
117 template<typename Asset>
118 void UnregisterAssetType() {
119 UnregisterAssetType(Asset::GetStaticType());
120 }
121
122 ECS::ComponentRegistrar* componentRegistrar = nullptr;
123 ECS::SystemRegistrar* systemRegistrar = nullptr;
124 private:
125 Grindstone::Plugins::IEditorInterface* editorInterface = nullptr;
126 Grindstone::Window* (*windowFactoryFn)(Grindstone::Window::CreateInfo&) = nullptr;
127 Grindstone::Display(*getMainDisplayFn)() = nullptr;
128 uint8_t (*countDisplaysFn)() = nullptr;
129 void (*enumerateDisplaysFn)(Grindstone::Display*) = nullptr;
130 };
131 }
132}
Definition AssetImporter.hpp:11
Definition BaseAssetRenderer.hpp:25
Definition Cvars.hpp:42
Definition DisplayManager.hpp:8
Definition ComponentRegistrar.hpp:18
Definition SystemRegistrar.hpp:12
Definition EngineCore.hpp:63
Definition Core.hpp:41
Definition HashedString.hpp:9
Definition Interface.hpp:47
Definition Interface.hpp:56
Definition RendererFeature.hpp:10
Definition SystemRegistrar.cs:4
Definition UniquePtr.hpp:7
Definition WindowManager.hpp:7
Definition Window.hpp:12
Definition ComponentInspector.hpp:11
Definition Buffer.hpp:9
Definition Interface.hpp:23
Definition Interface.hpp:52
Definition EditorPluginInterface.hpp:17
Definition AssetRendererFilter.hpp:6
Definition Assert.hpp:16
Definition Display.hpp:6
Definition Logger.hpp:14
Definition Window.hpp:20