blob: 4c377f0662d9447e98855c5eaae3b61080f5ec20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#pragma once
#include "state_manager.h"
#include "memory.h"
#include "window.h"
#include "event.h"
#include "log.h"
#include "engine/engine.h"
#include "rendering/renderer_backend.h"
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; }
auto get_state_manager() -> StateManager& { return *m_state_manager; }
auto get_engine() -> Engine& { return *m_engine; }
static auto get() -> Application& { return *s_instance; }
private:
auto on_init() -> void;
auto on_shutdown() -> void;
auto on_update() -> void;
auto on_render() -> void;
auto on_event(Event& event) -> void;
auto setup_docking_layout() -> void;
auto build_ui() -> void; // shared ImGui panel, drives the active RendererBackend
auto build_scene_ui() -> void; // scene-view (object list) section of the UI
private:
Scope<StateManager> m_state_manager;
Scope<Window> m_window;
Scope<Engine> m_engine;
Scope<RendererBackend> m_renderer; // active backend (non-null once a backend runs the app)
bool m_running;
bool m_minimized;
float m_delta_time = 0.0f;
float m_last_frame = 0.0f;
static Application* s_instance;
};
}
|