summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/video.hpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/include/video.hpp b/include/video.hpp
index a00f77e..23c1c6e 100644
--- a/include/video.hpp
+++ b/include/video.hpp
@@ -12,13 +12,37 @@ namespace wsdl2 {
typedef SDL_Point point;
typedef SDL_Rect rect;
+ class window;
+
+ class renderer {
+ public:
+ friend class window;
+
+ renderer(window& w);
+ virtual ~renderer();
+
+ inline void clear() { SDL_RenderClear(safe()); }
+ inline void present() { SDL_RenderPresent(safe()); }
+
+ // dirty C code
+ inline SDL_Renderer* sdl() { return m_renderer; }
+
+ private:
+ renderer();
+
+ SDL_Renderer* safe();
+ void create_sdl_renderer(SDL_Window *win);
+
+ SDL_Renderer *m_renderer;
+ };
+
class window {
public:
window() = delete;
window(const window& other) = delete;
window(const std::string& title, std::size_t width, std::size_t height);
- ~window();
+ virtual ~window();
// setters
void open();
@@ -35,9 +59,15 @@ namespace wsdl2 {
// rendering
void update();
+ // dirty C code
+ inline SDL_Window* sdl() { return m_window; }
+
private:
bool m_open;
+ renderer m_renderer;
SDL_Window *m_window;
- SDL_Renderer *m_renderer;
};
+
+
+
} \ No newline at end of file