aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/SdlContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/SdlContext.h')
-rw-r--r--src/crepe/SdlContext.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/crepe/SdlContext.h b/src/crepe/SdlContext.h
new file mode 100644
index 0000000..c8f1304
--- /dev/null
+++ b/src/crepe/SdlContext.h
@@ -0,0 +1,43 @@
+#pragma once
+
+#include "SDL_rect.h"
+#include "api/Sprite.h"
+#include "api/Transform.h"
+#include <SDL2/SDL_render.h>
+#include <SDL2/SDL_video.h>
+
+namespace crepe {
+
+
+class SdlContext {
+
+public:
+
+ void handleEvents(bool& running);
+ void clearScreen();
+ void presentScreen();
+ void draw(const api::Sprite&, const api::Transform&);
+
+ // singleton
+ static SdlContext & get_instance();
+ SDL_Texture* setTextureFromPath(const char*);
+ SDL_Texture* setTextureFromPath(const char*, SDL_Rect& clip, const int row, const int col);
+
+private:
+ SdlContext();
+ virtual ~SdlContext();
+
+ SdlContext(const SdlContext &) = delete;
+ SdlContext(SdlContext &&) = delete;
+ SdlContext & operator=(const SdlContext &) = delete;
+ SdlContext & operator=(SdlContext &&) = delete;
+
+
+private:
+
+ SDL_Window* m_game_window;
+ SDL_Renderer* m_game_renderer;
+};
+
+} //
+