lab.cpp/SDL#1/Sprite.h

64 lines
1.2 KiB
C
Raw Permalink Normal View History

2016-03-10 20:38:15 +00:00
#ifndef DEF_SPRITE_H
#define DEF_SPRITE_H
/* [LIBS] Internes
=========================================================*/
#include "SDL.h"
#include "SDL_image.h"
#include <vector>
/* [LIBS] Externes
=========================================================*/
/* [NS] Namespaces
=========================================================*/
using namespace std;
class Sprite{
public:
2016-03-10 23:00:26 +00:00
Sprite(SDL_Rect r);
Sprite(const int rgb[], SDL_Rect r);
Sprite(const char url[], SDL_Rect r, SDL_Rect clip);
void setImage(const char url[], int ox=0, int oy=0);
2016-03-10 20:38:15 +00:00
// ~Sprite();
void appendTo(SDL_Surface *dest);
// GETTERS
SDL_Surface *surface();
private:
SDL_Surface *_surface;
SDL_Rect _rect;
2016-03-10 23:00:26 +00:00
SDL_Rect _origin;
2016-03-10 20:38:15 +00:00
};
/* [AGGR] Groupement de Sprite
=========================================================*/
class SpriteGroup{
public:
SpriteGroup();
void add(Sprite *s);
void remove(Sprite *s);
Sprite* get(int i);
void appendTo(SDL_Surface *dest);
private:
vector<Sprite*> _sprites;
};
/* [BODY] Inclusion du corps
=========================================================*/
#include "Sprite.cpp"
#endif