#include #include #include #include "graph.h" SDL_Surface *screen; //variable globale cf commentaires void Init_Graph() //initialisation de SDL { SDL_Init(SDL_INIT_VIDEO); TTF_Init(); //permet un acces direct au framebuffer screen = SDL_SetVideoMode(480, 272, 32, SDL_FULLSCREEN); if(screen==NULL) { printf("Error in video driver\n:%s",SDL_GetError()); } SDL_ShowCursor(SDL_DISABLE); ///< plus de curseur pour l'ecran tactile } void Release_Graph() // Arrêt de SDL { SDL_FreeSurface(screen); SDL_Quit(); TTF_Quit(); } void Display() // Affichage du buffer { SDL_Flip(screen); } void Init_BG() // Initialisation du fond { Uint32 fond; fond = SDL_MapRGB(screen->format, 220,50,50); // fond bleu SDL_FillRect(screen, NULL, fond); } void Display_Image(char *Filename, int x, int y) // affichage image { SDL_Surface *Image; SDL_Rect position; Image = IMG_Load(Filename); mask(Image); position.x = x; position.y = y; SDL_BlitSurface(Image, NULL, screen, &position); SDL_FreeSurface(Image); } void mask(SDL_Surface *surface) // gestion problème RVB → BVR { surface->format->Rmask = 0xFF0000; surface->format->Gmask = 0x00FF00; surface->format->Bmask = 0x0000FF; }