Je débute auusi donc j'espert que tu pourra m'aider
:
- include <stdlib.h>
- include <stdio.h>
- include <SDL/SDL.h>
- include <SDL_image.h>
int main(int argc, char *argv[])
{
SDL_Surface *ecran = NULL, *fond = NULL, *Image;
SDL_Rect positionFond, positionImage[30];
SDL_Event event;
int continuer = 1;
long i = 0;
SDL_Init(SDL_INIT_VIDEO);
ecran = SDL_SetVideoMode(800, 640, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255));
SDL_WM_SetCaption("Tampon Image !", NULL);
fond = IMG_Load("fond.jpg");
positionFond.x = 0;
positionFond.y = 0;
SDL_BlitSurface(fond, NULL, ecran, &positionFond);
Image = IMG_Load("Image.bmp");
while(continuer)
{
SDL_WaitEvent(&event);
switch(event.type)
{
case SDL_QUIT:
continuer = 0;
break;
case SDL_KEYDOWN:
switch(event.key.keysym.sym)
{
break;
case SDLK_DELETE:
SDL_BlitSurface(fond, NULL, ecran, &positionFond);
i = 0;
break;
}
break;
case SDL_MOUSEBUTTONUP:
switch(event.button.button)
{
case SDL_BUTTON_LEFT:
if(SDL_MOUSEMOTION)
{
if(i < 30)
{
positionImage[i].x = (event.motion.x - Image->w / 2);
positionImage[i].y = (event.motion.y - Image->w / 2);
SDL_BlitSurface(Image, NULL, ecran, &positionImage[i]);
i++;
}
}
break;
}
break;
}
SDL_Flip(ecran);
}
SDL_FreeSurface(Image);
SDL_Quit();
return EXIT_SUCCESS;
Ce programme sert a coller un maximum de 30 images sur un écran (ce qui va me servir pour un éditeur de niveau pour un petit jeu que je vais "essayer" de faire) Mais le programme ne marche pas et je sais pas pourquoi 