9#include "resource/resource_manager.h"
10#include "platform/window/window_manager.h"
11#include "core/system.h"
12#include "system/render/render_settings.h"
13#include "core/clock.h"
14#include "core/event/event_bus.h"
15#include "core/host_chrome.h"
16#include "platform/input/input_map.h"
17#include "net/net_session.h"
19namespace Vkm::Engine {
32 Engine(
const Engine& other) =
delete;
33 Engine& operator=(
const Engine& other) =
delete;
35 Engine(Engine && other) =
delete;
36 Engine& operator=(Engine && other) =
delete;
44 void setFPSLog(
bool enabled =
true) { m_fpsLog = enabled; }
62 template<
typename T,
typename... Args>
64 auto system = std::make_unique<T>(std::forward<Args>(args)...);
66 m_systemsByStage[
static_cast<size_t>(stage)].push_back(std::move(system));
70 Scene& getScene() {
return m_scene; }
71 const Scene& getScene()
const {
return m_scene; }
73 ResourceManager& getResources() {
return m_resources; }
74 const ResourceManager& getResources()
const {
return m_resources; }
76 Clock& getClock() {
return m_clock; }
77 const Clock& getClock()
const {
return m_clock; }
79 EventBus& getEvents() {
return m_events; }
80 const EventBus& getEvents()
const {
return m_events; }
90 WindowManager& getWindow() {
return m_window; }
91 const WindowManager& getWindow()
const {
return m_window; }
117 m_projectRender = project;
134 using SystemList = std::vector<std::unique_ptr<System>>;
136 void initSystems(FrameContext& ctx);
137 void shutdownSystems();
145 ResourceManager m_resources;
149 WindowManager m_window;
152 RenderSettings m_render;
153 RenderSettings m_projectRender;
155 std::array<SystemList, static_cast<size_t>(SystemStage::Count)> m_systemsByStage;
157 bool m_initialized =
false;
158 bool m_fpsLog =
false;
const RenderSettings & getProjectRenderSettings() const
The project.json render block the session started from (setProjectRenderSettings).
Definition engine.h:122
InputMap & getInput()
The action map gameplay reads input through.
Definition engine.h:87
NetSession & getNet()
The session this end is playing in, offline until told otherwise.
Definition engine.h:130
void setFPSLog(bool enabled=true)
Log "FPS: N (M ms)" to the console once a second.
Definition engine.h:44
RenderSettings & getRenderSettings()
The quality settings this session draws at.
Definition engine.h:107
T & addSystem(SystemStage stage, Args &&... args)
Create and register a system at the given execution stage.
Definition engine.h:63
void setProjectRenderSettings(const RenderSettings &project)
Start the session from project, the project.json render block: the session's settings and the copy ga...
Definition engine.h:116
HostChrome & getChrome()
What an authoring host says about the frame it draws over.
Definition engine.h:98
void run()
Run the main loop, blocking until the window closes or the process is interrupted.
What an authoring host tells the engine about the frame it draws over.
Definition host_chrome.h:18
One end of a game, whether it is the authority or a guest.
Definition net_session.h:118
Central registry managing entities and an open set of component types.
Definition scene.h:29
Editable render tuning: pass toggles + per-effect parameters.
Definition render_settings.h:101