2016-03-11 15:17:57 +00:00
|
|
|
#ifndef DEF_SDLTL_H
|
|
|
|
|
|
|
|
#define DEF_SDLTL_H
|
|
|
|
|
|
|
|
/* [LIBS] Internes
|
|
|
|
=========================================================*/
|
|
|
|
#include "SDL.h"
|
2016-03-11 23:10:38 +00:00
|
|
|
#include "SDL_image.h"
|
2016-03-11 15:17:57 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
/* [LIBS] Externes
|
|
|
|
=========================================================*/
|
|
|
|
|
|
|
|
|
|
|
|
/* [NS] Namespaces
|
|
|
|
=========================================================*/
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
class sdltl{
|
|
|
|
|
|
|
|
public:
|
|
|
|
sdltl(const char *t, int w, int h);
|
|
|
|
~sdltl();
|
|
|
|
SDL_Window *window();
|
|
|
|
SDL_Renderer *renderer();
|
|
|
|
bool status();
|
2016-03-11 23:10:38 +00:00
|
|
|
bool setBackground(Uint8 r=0xff, Uint8 g=0xff, Uint8 b=0xff, Uint8 a=0xff);
|
2016-03-11 15:17:57 +00:00
|
|
|
bool setImage(const char *url);
|
|
|
|
void waitEvent(SDL_EventType t, void(*handler)(SDL_Event*) );
|
|
|
|
|
2016-03-11 23:10:38 +00:00
|
|
|
void push(SDL_Texture *t, SDL_Rect *origin, SDL_Rect *dest);
|
|
|
|
void pull(SDL_Texture *t);
|
|
|
|
|
2016-03-11 15:17:57 +00:00
|
|
|
void update();
|
|
|
|
|
|
|
|
void manageFps(const int fps=0);
|
|
|
|
|
|
|
|
private:
|
|
|
|
// gestion FPS
|
|
|
|
Uint32 _lasttick;
|
|
|
|
Uint32 _fpstime;
|
|
|
|
|
|
|
|
// status de l'initialisation
|
|
|
|
bool _status;
|
|
|
|
|
|
|
|
// Elements utiles
|
|
|
|
SDL_Window *_window;
|
|
|
|
SDL_Renderer *_renderer;
|
|
|
|
SDL_Texture *_texture;
|
|
|
|
|
|
|
|
vector<SDL_Texture*> _sprites;
|
2016-03-11 23:10:38 +00:00
|
|
|
vector<SDL_Rect*> _src;
|
|
|
|
vector<SDL_Rect*> _dst;
|
2016-03-11 15:17:57 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* [BODY] Inclusion du corps
|
|
|
|
=========================================================*/
|
|
|
|
#include "sdltl.cpp"
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|