diff options
Diffstat (limited to 'window.h')
-rw-r--r-- | window.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/window.h b/window.h new file mode 100644 index 0000000..bdd1e91 --- /dev/null +++ b/window.h @@ -0,0 +1,36 @@ +#pragma once + +#include <functional> + +class Bitmap; + +struct SDL_Window; +struct SDL_Renderer; +struct SDL_Texture; + +class Window { +public: + Window(const char* title, int width, int height, int scale); + ~Window(); + + void update(); + void draw(Bitmap&); + + bool shouldClose() { return !m_isRunning; } + + void onMouseDown(std::function<void(int, int, int)> callback) { m_mouseDown = callback; } + void onMouseUp(std::function<void(int, int, int)> callback) { m_mouseUp = callback; } + void onMouseMove(std::function<void(int, int)> callback) { m_mouseMove = callback; } +private: + bool m_isRunning; + + int m_width, m_height, m_scale; + + SDL_Window* m_window; + SDL_Renderer* m_renderer; + SDL_Texture* m_texture; + + std::function<void(int, int, int)> m_mouseDown; + std::function<void(int, int, int)> m_mouseUp; + std::function<void(int, int)> m_mouseMove; +};
\ No newline at end of file |