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
21namespace Grindstone {
22 namespace Memory::AllocatorCore {
23 struct AllocatorState;
24 }
25
26 namespace GraphicsAPI {
27 class Core;
28 }
29
30 namespace ECS {
31 class SystemRegistrar;
32 }
33
34 class WindowManager;
35 class DisplayManager;
37
38 namespace Plugins {
39 class Manager;
40
42 public:
43 BaseEditorInterface() = default;
46 virtual ~BaseEditorInterface() {}
47 };
48
49 class ENGINE_CORE_API Interface {
50 public:
51 Interface(Manager* manager);
52
53 virtual void SetEditorInterface(BaseEditorInterface* editorInterface);
54 virtual BaseEditorInterface* GetEditorInterface() const;
55
56 virtual EngineCore* GetEngineCore();
57 virtual GraphicsAPI::Core* GetGraphicsCore();
58 virtual bool LoadPlugin(const char* name);
59 virtual void LoadPluginCritical(const char* name);
60 virtual void RegisterGraphicsCore(Grindstone::GraphicsAPI::Core* core);
61 virtual void RegisterWindowManager(Grindstone::WindowManager*);
62 virtual void RegisterDisplayManager(Grindstone::DisplayManager*);
63 virtual Window* CreateDisplayWindow(Window::CreateInfo&);
64 virtual Display GetMainDisplay();
65 virtual uint8_t CountDisplays();
66 virtual void EnumerateDisplays(Display* displays);
67 virtual void RegisterSystem(const char* name, ECS::SystemFactory factory);
68 virtual void RegisterEditorSystem(const char* name, ECS::SystemFactory factory);
69 virtual void UnregisterSystem(const char* name);
70 virtual void UnregisterEditorSystem(const char* name);
71 virtual void RegisterAssetRenderer(BaseAssetRenderer* assetRenderer);
72 virtual void UnregisterAssetRenderer(BaseAssetRenderer* assetRenderer);
73 virtual void RegisterAssetType(AssetType assetType, const char* typeName, AssetImporter* assetImporter);
74 virtual void UnregisterAssetType(AssetType assetType);
75 virtual void SetReloadCsharpCallback(std::function<void()> callback);
76 virtual Grindstone::Logger::LoggerState* GetLoggerState() const;
77 virtual Grindstone::Memory::AllocatorCore::AllocatorState* GetAllocatorState() const;
78
79 template<typename ClassType>
80 void RegisterComponent(Grindstone::ECS::SetupComponentFn setupComponentFn = nullptr, Grindstone::ECS::DestroyComponentFn destroyComponentFn = nullptr) {
81 componentRegistrar->RegisterComponent<ClassType>(setupComponentFn, destroyComponentFn);
82 }
83
84 template<typename T>
85 void UnregisterComponent() {
86 componentRegistrar->UnregisterComponent<T>();
87 }
88
89 ECS::ComponentRegistrar* componentRegistrar = nullptr;
90 ECS::SystemRegistrar* systemRegistrar = nullptr;
91 private:
92 EngineCore* engineCore = nullptr;
93 BaseEditorInterface* editorInterface = nullptr;
94 Manager* manager = nullptr;
95 GraphicsAPI::Core* graphicsCore = 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 friend Manager;
102 };
103 }
104}
Definition AssetImporter.hpp:10
Definition BaseAssetRenderer.hpp:25
Definition DisplayManager.hpp:8
Definition ComponentRegistrar.hpp:16
Definition SystemRegistrar.hpp:12
Definition EngineCore.hpp:57
Definition Core.hpp:31
Definition Interface.hpp:41
Definition Interface.hpp:49
Definition Manager.hpp:16
Definition SystemRegistrar.cs:4
Definition WindowManager.hpp:7
Definition Window.cs:7
Definition Display.hpp:6
Definition Logger.hpp:14
Definition Window.hpp:20