aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/spritesheet.h
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-10-02 15:57:59 +0200
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-10-02 15:57:59 +0200
commitde2c2593f9f272c5151d74af4ff846fdd70a9bc7 (patch)
tree4001a60809734a60b75e39da5c994d9381b6efe2 /src/crepe/api/spritesheet.h
parent41bd601ef62d967c80cc0591eaf6b4290baae425 (diff)
working resource manager and textures and sprite to new standard
Diffstat (limited to 'src/crepe/api/spritesheet.h')
-rw-r--r--src/crepe/api/spritesheet.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/crepe/api/spritesheet.h b/src/crepe/api/spritesheet.h
index e7530c2..7f46296 100644
--- a/src/crepe/api/spritesheet.h
+++ b/src/crepe/api/spritesheet.h
@@ -4,18 +4,35 @@
#include "Resource.h"
-#include <string>
+#include "SDL_rect.h"
+#include "SDL_render.h"
+#include <memory>
namespace crepe::api {
+class Spritesheet{
+public:
+ Spritesheet(const char * src, const int row , const int col);
+ Spritesheet(std::unique_ptr<api::Resource> res, const int row, const int col);
+ ~Spritesheet();
-class SpriteSheet : public Resource{
+ void select_sprite(const int x, const int y);
+ void draw_selected_sprite(const int x, const int y);
+private:
+ void load(std::unique_ptr<api::Resource> res, const int row, const int col);;
+ SDL_Texture* get_texture() const;
-public:
- SpriteSheet(const std::string&);
- ~SpriteSheet();
+
+private:
+
+ SDL_Texture* m_spritesheet;
+ SDL_Rect m_clip;
+
+ friend class SdlContext;
};
+
}
+