From 98e2eb0beed4f57461956a10eeae014bf88a51c6 Mon Sep 17 00:00:00 2001 From: cflip Date: Sun, 23 Jan 2022 17:11:38 -0700 Subject: Simple tile editor --- window.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 window.h (limited to 'window.h') 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 + +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 callback) { m_mouseDown = callback; } + void onMouseUp(std::function callback) { m_mouseUp = callback; } + void onMouseMove(std::function 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 m_mouseDown; + std::function m_mouseUp; + std::function m_mouseMove; +}; \ No newline at end of file -- cgit v1.2.3