Jeanyveyve, j´avais testé avec ton premier tuto de la sdl. Voici le code:
- include < SDL/SDL.h>
SDL_Surface* screen; // l´ecran principale
SDL_Surface* firstscreen; / / tampon temporaire
SDL_Event event; // gestion d´evenement
void init_SDL() // initialise SDL
{
SDL_Init(SDL_INIT_VIDEO); // preapare SDL
screen = SDL_SetVideoMode(1024, 768, 32,SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_FULLSCREEN); / / mode graphique
SDL_ShowCursor(0); / / eneleve la souris
}
void waitkey() // attend qu´on appuie sur RETURN
{
while(1) // boucle
{
while(SDL_PollEvent(&)) // aquisition d´evenement
{
if ( event.type == SDL_KEYDOWN) / / on appuie sur une touche ?
{
if ( event.key.keysym.sym == SDLK_RETURN) return; / / c´est " RETURN" ?
}
}
}
}
int main(int argc , char **argv)
{
SDL_Rect rect1; // structure rectangle
init_SDL(); // initialise ( plus haut)
firstscreen = SDL_LoadBMP("image.bmp"); // charge l´image
/ / on dessine
rect1.x = 0;
rect1.y = 0;
rect1.w = 1024; // défini le rectangle
rect1.h = 768;
SDL_BlitSurface(firstscreen,NULL,screen,&1); /
/ colle l´image sur l´écran, NULL car on affiche TOUTE l´image
SDL_Flip(screen); // affiche la prochaine frame
waitkey(); // attends qu´on appuie sur Return ( plus haut)
SDL_ShowCursor(1); // reactive la souris
SDL_Quit(); // quitte SDL
return 0; // quitte le programme
}