20#include "SD/export.hpp"
35 std::string
name =
"SDEngine App";
48 void run(
const std::atomic<bool>* external_stop);
50 void close() { is_running =
false; }
53 template<
typename T,
typename... Args>
54 requires std::is_base_of_v<Layer, T>
56 auto& layer = global_layers.push_layer<T>(std::forward<Args>(args)...);
62 return window_manager->create(props, engine_arena);
65 return window_manager->get_window(
id);
68 return window_manager->get_render_window(
id);
71 template<
typename T,
typename... Args>
72 requires std::is_base_of_v<Layer, T>
73 T& push_window_layer(
WindowId id, Args&&... args);
75 template<
typename T,
typename... Args>
76 requires std::is_base_of_v<View, T>
78 auto& view = view_manager->create<T>(arena, std::move(name), std::forward<Args>(args)...);
85 return view_manager->get(name);
87 [[nodiscard]] std::expected<ViewId, ViewError>
get_view_id(
const std::string& name)
const {
88 return view_manager->get_id(name);
93 return view_manager->remove(name);
96 template<
typename T,
typename... Args>
97 requires std::is_base_of_v<Layer, T>
98 std::expected<std::reference_wrapper<T>,
ViewError> push_layer_to_view(
ViewId id, Args&&... args);
100 template<
typename T,
typename... Args>
101 requires std::is_base_of_v<Layer, T>
102 std::expected<std::reference_wrapper<T>,
ViewError> push_layer_to_view(
const std::string& name,
106 return scene_manager.create(arena, name);
108 [[nodiscard]]
Scene*
get_scene(
const std::string& name)
const {
return scene_manager.get(name); }
110 void clear_game_layers();
112 void request_restart() { m_restart_requested.store(
true, std::memory_order_release); }
114 return m_restart_requested.exchange(
false, std::memory_order_acq_rel);
119 return m_shader_reload_requested.exchange(
false, std::memory_order_acq_rel);
121 void dispatch_shader_reload();
126 .vulkan = *m_vulkan_ctx,
127 .renderer = *m_renderer,
128 .imgui = *m_imgui_ctx,
134 .
views = *view_manager,
135 .scenes = scene_manager,
136 .layout = *layout_manager,
137 .events = app_event_manager,
139 .global_layers = global_layers,
140 .hot_reload_enabled = hot_reload_enabled,
Definition Application.hpp:22
ViewError
Definition View.hpp:27
Definition ApplicationRuntime.hpp:12
ViewManager & views
Definition ApplicationRuntime.hpp:13
Definition Application.hpp:34
int width
Definition Application.hpp:36
std::string gameSoPath
Definition Application.hpp:39
int height
Definition Application.hpp:37
bool enableHotReload
Definition Application.hpp:38
std::string name
Definition Application.hpp:35
Definition Application.hpp:42
ViewError remove_view(ViewId id)
Definition Application.hpp:91
void request_shader_reload()
Definition Application.hpp:117
FrameTimer timer
Definition Application.hpp:162
ViewManager * view_manager
Definition Application.hpp:154
SDImGuiContext * m_imgui_ctx
Definition Application.hpp:173
RuntimeStateManager * state_manager
Definition Application.hpp:161
std::expected< ViewId, ViewError > get_view_id(const std::string &name) const
Definition Application.hpp:87
ViewError remove_view(const std::string &name)
Definition Application.hpp:92
ViewResult get_view(const std::string &name) const
Definition Application.hpp:84
EngineServices services() const
Definition Application.hpp:123
GlfwContext * m_glfw_ctx
Definition Application.hpp:170
WindowManager * window_manager
Definition Application.hpp:153
bool game_code_reload_paused
Definition Application.hpp:149
Scene * get_scene(const std::string &name) const
Definition Application.hpp:108
Arena * m_frame_arena
Definition Application.hpp:165
ApplicationRuntime runtime()
Definition Application.hpp:132
Scene * create_scene(Arena *arena, const std::string &name)
Definition Application.hpp:105
ViewManager::ViewResult ViewResult
Definition Application.hpp:43
LayoutManager * layout_manager
Definition Application.hpp:155
std::atomic< bool > m_restart_requested
Definition Application.hpp:167
Arena * engine_arena
Definition Application.hpp:164
bool is_running
Definition Application.hpp:147
void close()
Definition Application.hpp:50
SceneManager scene_manager
Definition Application.hpp:156
Arena * frame_arena() const
Definition Application.hpp:144
bool consume_restart_request()
Definition Application.hpp:113
void request_restart()
Definition Application.hpp:112
T & create_view(Arena *arena, std::string name, Args &&... args)
Definition Application.hpp:77
VulkanWindow & get_render_window(const WindowId id) const
Definition Application.hpp:67
Window & get_window(const WindowId id) const
Definition Application.hpp:64
T & push_layer(Args &&... args)
Definition Application.hpp:55
EventManager app_event_manager
Definition Application.hpp:159
ApplicationSpecification app_spec
Definition Application.hpp:151
std::atomic< bool > m_shader_reload_requested
Definition Application.hpp:168
ViewResult get_view(const ViewId id) const
Definition Application.hpp:83
bool consume_shader_reload_request()
Definition Application.hpp:118
VulkanRenderer * m_renderer
Definition Application.hpp:172
VulkanContext * m_vulkan_ctx
Definition Application.hpp:171
bool hot_reload_enabled
Definition Application.hpp:148
LayerList global_layers
Definition Application.hpp:158
WindowId create_window(const WindowProps &props)
Definition Application.hpp:61
Definition EngineServices.hpp:10
GlfwContext & glfw
Definition EngineServices.hpp:11
Definition EventManager.hpp:12
Definition EventVariant.hpp:19
Tracks frame timing, fixed timestep accumulation, and CPU work time.
Definition FrameTimer.hpp:21
RAII wrapper for initializing and terminating Glfw. Also sets a glfwErrorCallback.
Definition GlfwContext.hpp:25
Definition LayerList.hpp:15
Manages window layouts using ImGui DockBuilder for presets and INI for user layouts.
Definition LayoutManager.hpp:14
Definition RuntimeStateManager.hpp:24
Definition SDImGuiContext.hpp:27
Definition SceneManager.hpp:14
Definition id_types.hpp:7
Definition ViewManager.hpp:21
std::expected< std::reference_wrapper< View >, ViewError > ViewResult
Definition ViewManager.hpp:41
Definition VulkanContext.hpp:22
Definition VulkanRenderer.hpp:10
Definition VulkanWindow.hpp:35
Definition id_types.hpp:29
Definition WindowManager.hpp:43
Definition WindowManager.hpp:26