aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/spritesheet.h
blob: 7f4629687c6a2bc0572bc96493c3c0f3a1d0b0a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#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;

	friend class SdlContext;
};

}