From 9037aca03bfa4312794a6954752628381256f777 Mon Sep 17 00:00:00 2001 From: heavydemon21 Date: Tue, 22 Oct 2024 12:15:03 +0200 Subject: merged further and changed to standard --- src/crepe/SdlContext.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/crepe/SdlContext.h (limited to 'src/crepe/SdlContext.h') 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 +#include + +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; +}; + +} // + -- cgit v1.2.3