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 {
23 namespace Memory::AllocatorCore {
24 struct AllocatorState;
25 }
26
27 namespace GraphicsAPI {
28 class Core;
29 }
30
31 namespace ECS {
32 class SystemRegistrar;
33 }
34
35 class CvarSystem;
36 class WindowManager;
37 class DisplayManager;
39
40 namespace Plugins {
41 class Manager;
42
44 public:
45 virtual ~IEditorInterface() {}
46 };
47
48 class ENGINE_CORE_API Interface {
49 public:
50 virtual void SetEditorInterface(Grindstone::Plugins::IEditorInterface* editorInterface);
51 virtual Grindstone::Plugins::IEditorInterface* GetEditorInterface() const;
52
53 virtual EngineCore* GetEngineCore();
54 virtual GraphicsAPI::Core* GetGraphicsCore();
55 virtual void RegisterGraphicsCore(Grindstone::GraphicsAPI::Core* core);
56 virtual void RegisterWindowManager(Grindstone::WindowManager*);
57 virtual void RegisterDisplayManager(Grindstone::DisplayManager*);
58 virtual Window* CreateDisplayWindow(Window::CreateInfo&);
59 virtual Display GetMainDisplay();
60 virtual uint8_t CountDisplays();
61 virtual void EnumerateDisplays(Display* displays);
62 virtual void RegisterSystem(const char* name, ECS::SystemFactory factory);
63 virtual void RegisterEditorSystem(const char* name, ECS::SystemFactory factory);
64 virtual void UnregisterSystem(const char* name);
65 virtual void UnregisterEditorSystem(const char* name);
66 virtual void RegisterAssetRenderer(BaseAssetRenderer* assetRenderer);
67 virtual void UnregisterAssetRenderer(BaseAssetRenderer* assetRenderer);
68 virtual void RegisterAssetType(AssetType assetType, const char* typeName, AssetImporter* assetImporter);
69 virtual void UnregisterAssetType(AssetType assetType);
70 virtual Grindstone::HashedString::HashMap* GetHashedStringMap() const;
71 virtual Grindstone::Logger::LoggerState* GetLoggerState() const;
72 virtual Grindstone::Memory::AllocatorCore::AllocatorState* GetAllocatorState() const;
73 virtual Grindstone::CvarSystem* GetCvarSystem() const;
74 virtual void RegisterWorldContextFactory(Grindstone::HashedString contextName, Grindstone::UniquePtr<Grindstone::WorldContext> (*FactoryFn)());
75 virtual void UnregisterWorldContextFactory(Grindstone::HashedString contextName);
76
77 template<typename ClassType>
78 void RegisterWorldContextFactory(Grindstone::HashedString contextName) {
79 RegisterWorldContextFactory(contextName, Grindstone::WorldContext::Create<ClassType>);
80 }
81
82 template<typename ClassType>
83 void RegisterComponent() {
84 componentRegistrar->RegisterComponent<ClassType>();
85 }
86
87 template<typename T>
88 void UnregisterComponent() {
89 componentRegistrar->UnregisterComponent<T>();
90 }
91
92 ECS::ComponentRegistrar* componentRegistrar = nullptr;
93 ECS::SystemRegistrar* systemRegistrar = nullptr;
94 private:
95 Grindstone::Plugins::IEditorInterface* editorInterface = nullptr;
96 Grindstone::Window* (*windowFactoryFn)(Grindstone::Window::CreateInfo&) = nullptr;
97 Grindstone::Display(*getMainDisplayFn)() = nullptr;
98 uint8_t (*countDisplaysFn)() = nullptr;
99 void (*enumerateDisplaysFn)(Grindstone::Display*) = nullptr;
100 };
101 }
102}
Definition AssetImporter.hpp:11
Definition BaseAssetRenderer.hpp:23
Definition Cvars.hpp:42
Definition DisplayManager.hpp:8
Definition ComponentRegistrar.hpp:18
Definition SystemRegistrar.hpp:12
Definition EngineCore.hpp:60
Definition Core.hpp:41
Definition HashedString.hpp:9
Definition Interface.hpp:43
Definition Interface.hpp:48
Definition UniquePtr.hpp:7
Definition WindowManager.hpp:7
Definition Window.hpp:12
Definition Display.hpp:6
Definition Logger.hpp:14
Definition Window.hpp:20