J'ai un problème à l'exécution du code suivant :
- Code: Select all
#include <os.h>
#include <SDL/SDL.h>
#include <SDL/fdlibm.h>
#include <SDL/SDL_gfxPrimitives.h>
#include "img.h"
int main(void) {
int i=0,x,y;
SDL_Surface *screen;
nSDL_Font *font;
SDL_Surface *mario_sdl;
SDL_Rect position_mario;
SDL_Init(SDL_INIT_VIDEO);
screen = SDL_SetVideoMode(320, 240, is_cx ? 16 : 8, SDL_SWSURFACE);
font = nSDL_LoadFont(NSDL_FONT_THIN,
SDL_MapRGB(screen->format, 29, 43, 61),
NSDL_FONTCFG_DEFAULT);
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 184, 200, 222));
nSDL_DrawString(screen, font, (int)(rand()%250), (int)(rand()%180), "Hello, world! \x1");
// nl_relocdata((unsigned*)image_mario, sizeof(image_mario)/sizeof(unsigned short));
mario_sdl=nSDL_LoadImage(image_mario);
position_mario.x = 0;
position_mario.y = 0;
/* On blitte par-dessus l'écran */
SDL_BlitSurface(image_mario, NULL, screen, &position_mario); //l'erreur à l'exécution est ici mais pourquoi ?
SDL_Flip(screen);
wait_key_pressed();
boxColor(screen, 0, 0, 320, 240, 0);
SDL_Flip(screen);
SDL_Delay(3000);
SDL_FreeSurface(mario_sdl);
SDL_Quit();
return 0;
}
*/
L'erreur intervenant à l'exécution du programme est la suivante : "Surfaces must not be locked during blit"
Quelqu'un a t-il une idée ?
Merci