aboutsummaryrefslogtreecommitdiff
path: root/src/Core/Application.h
blob: b8c9d492e8962d1b700be5496eba3256543b79d3 (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
#pragma once

#include "Window.h"
#include "Event.h"
#include <memory>
#include <functional>

namespace Donut
{
    class VertexArray;
    class VertexBuffer;
    class IndexBuffer;
    class Shader;
};

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

        void Run();
        void Close();

        Window& GetWindow()       { return *m_Window;   }
        static Application& Get() { return *s_Instance; }
    private:
        void OnInit();
        void OnShutdown();
        void OnUpdate();
        void OnRender();
        void OnEvent(Event& event);
    private:
        std::unique_ptr<Window> m_Window;
        bool m_Running;
        bool m_Minimized;

        std::shared_ptr<VertexArray> m_VertexArray;
        std::shared_ptr<VertexBuffer> m_VertexBuffer;
        std::shared_ptr<IndexBuffer> m_IndexBuffer;
        std::shared_ptr<Shader> m_Shader;

        static Application* s_Instance;
    };
}