aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/SdlContext.h
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-10-22 12:15:03 +0200
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-10-22 12:15:03 +0200
commit9037aca03bfa4312794a6954752628381256f777 (patch)
treeb5402ae6552ca84bb4cdf9a2f1507dc460a399ac /src/crepe/SdlContext.h
parent176ac90fce318334f1377d94d6e637e1eff84c3c (diff)
merged further and changed to standard
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;
+};
+
+} //
+