61 lines
1.1 KiB
C++
61 lines
1.1 KiB
C++
#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:
|
|
Sprite(int x, int y, int w, int h);
|
|
Sprite(int c[], int x, int y, int w, int h);
|
|
Sprite(const char url[], int x, int y, int w, int h);
|
|
|
|
// ~Sprite();
|
|
void appendTo(SDL_Surface *dest);
|
|
|
|
// GETTERS
|
|
SDL_Surface *surface();
|
|
|
|
private:
|
|
SDL_Surface *_surface;
|
|
SDL_Rect _rect;
|
|
|
|
};
|
|
|
|
/* [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 |