hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/core/application.h
blob: 048503b8ec748703d06da98ed1ec0ffa0ee099cc (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
#pragma once

#include "memory.h"
#include "window.h"
#include "event.h"
#include "log.h"
#include "state_manager.h"

namespace Donut
{
    class Application
    {
    public:
        Application(const std::string& name = "Donut", 
                    int width = 1280, int height = 720);
        ~Application();

        void run();
        void close();

        Window& get_window()       { return *m_window;   }
        static Application& get() { return *s_instance; }
    private:
        void on_init();
        void on_shutdown();
        void on_update();
        void on_render();
        void on_event(Event& event);
    private:
        Scope<StateManager> m_state_manager;
        Scope<Window> m_window;

        bool m_running;
        bool m_minimized;
        
        float m_delta_time = 0.0f;
        float m_last_frame = 0.0f;

        static Application* s_instance;
    };
}