euh en faite c'est une réponse plus précise que je cherche comme par exemple pourquoi je ne suis pas
capable de prendre le fichier que j'ai demandé. J'ai pourtant mis dans mon utilisateur par défaut.
voici mon code:
#include <stdlib.h>
#include <SDL/SDL.h>
int main(int argc, char *argv[])
{
SDL_Init (SDL_INIT_VIDEO); /* See documentation for details */
SDL_Surface *screen;
int done;
SDL_Event event;
/* Have a preference for 8-bit, but accept any depth */
screen = SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE|SDL_ANYFORMAT);
if ( screen == NULL ) {
fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n",
SDL_GetError());
exit(1);
}
printf("Set 640x480 at %d bits-per-pixel mode\n",
screen->format->BitsPerPixel);
SDL_Surface *image;
/* Load the BMP file into a surface */
image = SDL_LoadBMP("icon.bmp");
if (image == NULL) {
fprintf(stderr, "Couldn't load: %s\n", SDL_GetError());
return (0);
}
/*
* Palettized screen modes will have a default palette (a standard
* 8*8*4 colour cube), but if the image is palettized as well we can
* use that palette for a nicer colour matching
*/
if (image->format->palette && screen->format->palette) {
SDL_SetColors(screen, image->format->palette->colors, 0,
image->format->palette->ncolors);
}
/* Blit onto the screen surface */
if(SDL_BlitSurface(image, NULL, screen, NULL) < 0)
fprintf(stderr, "BlitSurface error: %s\n", SDL_GetError());
SDL_UpdateRect(screen, 0, 0, image->w, image->h);
/* Free the allocated BMP surface */
SDL_FreeSurface(image);
done = 0;
while ( !done ) {
/* Check for events */
while ( SDL_PollEvent(&event) ) {
switch (event.type) {
case SDL_MOUSEMOTION:
break;
case SDL_MOUSEBUTTONDOWN:
break;
case SDL_KEYDOWN:
/* Any keypress quits the app... */
case SDL_QUIT:
done = 1;
break;
default:
break;
}
}
}
/* Clean up the SDL library */
SDL_Quit();
return(0);
}