#pragma once #include "memory.h" #include "window.h" #include "event.h" #include "log.h" #include "rendering/rhi.h" #include "rendering/render_path.h" #include "rendering/view.h" #include "scene/scene.h" #include "ui/ui_layer.h" #include namespace Donut { class Application { public: Application(const std::string& name = "Donut", int width = 1280, int height = 720); ~Application(); auto run() -> void; auto close() -> void; auto get_window() -> Window& { return *m_window; } static auto get() -> Application& { return *s_instance; } private: auto on_init() -> void; auto on_shutdown() -> void; auto on_event(Event& event) -> void; auto render_frame() -> void; auto update_input(View view) -> void; private: Scope m_window; Scope m_device; Scope m_scene; Scope m_render_path; Scope m_ui; bool m_left_was_down = false; double m_fps_last_x = 0.0, m_fps_last_y = 0.0; double m_last_frame_time = 0.0; double m_start_time = 0.0; bool m_user_moving = false; bool m_running = true; bool m_minimized = false; static Application* s_instance; }; }