summaryrefslogtreecommitdiffstats
path: root/include/video.hpp
blob: a00f77e4206f3d985a62e36edde5776786c78f1a (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
#pragma once

#include <string>
#include <array>

extern "C" {
#include <SDL2/SDL_video.h>
#include <SDL2/SDL_render.h>
}

namespace wsdl2 {
    typedef SDL_Point point;
    typedef SDL_Rect rect;

    class window {
    public:
        window() = delete;
        window(const window& other) = delete;

        window(const std::string& title, std::size_t width, std::size_t height);
        ~window();

        // setters
        void open();
        void close();

        inline void show() { SDL_ShowWindow(m_window); }
        inline void hide() { SDL_HideWindow(m_window); }
        inline void raise() { SDL_RaiseWindow(m_window); }

        // getters
        bool is_open();
        bool is_visible();

        // rendering
        void update();

    private:
        bool m_open;
        SDL_Window *m_window;
        SDL_Renderer *m_renderer;
    };
}