aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/spritesheet.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/api/spritesheet.h')
-rw-r--r--src/crepe/api/spritesheet.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/crepe/api/spritesheet.h b/src/crepe/api/spritesheet.h
new file mode 100644
index 0000000..503dcef
--- /dev/null
+++ b/src/crepe/api/spritesheet.h
@@ -0,0 +1,34 @@
+#pragma once
+
+
+
+
+#include "Resource.h"
+#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();
+
+ 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;
+
+private:
+
+ SDL_Texture* m_spritesheet;
+ SDL_Rect m_clip;
+};
+
+}
+