1 | #ifndef WINDOW_SDL2_HPP_ |
2 | #define WINDOW_SDL2_HPP_ |
3 |
|
4 |
|
5 | #include "IWindow.hpp" |
6 | #include <cstdint> |
7 | #include <string> |
8 | #include <SDL2/SDL.h> |
9 |
|
10 | class WindowSDL2 : public IWindow |
11 | { |
12 | public: |
13 | WindowSDL2(std::string title, uint64_t window_config_flags); |
14 | ~WindowSDL2(); |
15 |
|
16 | bool Update(uint64_t time_since_last_update_us) override; |
17 |
|
18 | // Basic public interface |
19 | void SetTitle(std::string new_title) override; |
20 | void SetFullscreen(bool is_fullscreen) override; |
21 | void SetSize(uint64_t new_width, uint64_t new_height) override; |
22 | void SetPosition(uint64_t new_x, uint64_t new_y) override; |
23 |
|
24 | protected: |
25 | // One-time SDL_Init() |
26 | static bool s_sdlInitialized; |
27 | static void _SdlInitialize(); |
28 |
|
29 | // Window object info |
30 | SDL_Window *m_pSdlWindow; |
31 | SDL_Renderer *m_pSdlRenderer; |
32 | SDL_GLContext m_pGlContext; |
33 | std::string m_windowTitle; |
34 | }; |
35 |
|
36 |
|
37 | #endif /* WINDOW_SDL2_HPP_ */ |
38 |
|