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