Bonjour,
je suis actuellement sur un projet en SDL.J'ai un probleme, j'essaye de faire bouger un carré sur l'ecran.Mais le probleme c que le carré precedant est toujours present.Comment dois-je faire pour le supprimer ?
Voici mon programme:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
include "stdafx.h"
#include "sdl.h"
#include "stdio.h"
#include <ctime>
 
SDL_Surface *ecran;
 
 
void move(int x,int y,SDL_Rect *d ,SDL_Surface * image,char *path="P.bmp")
{
 
 
	d->x=x;
	d->y=y;
	d->w=10;
	d->h=10;
 
	SDL_BlitSurface(image, NULL, ecran, d);
	SDL_BlitSurface( image, NULL, ecran, NULL );
	SDL_UpdateRects(ecran, 1, d);
 
 
 
}
int _tmain(int argc, _TCHAR* argv[])
{
	SDL_Event even;
	SDL_Rect d;
	SDL_Init( SDL_INIT_EVERYTHING );
	ecran = SDL_SetVideoMode( 150, 150, 32, SDL_SWSURFACE );
 
	srand( time(NULL) );
	SDL_Surface *image = SDL_LoadBMP( "Fond.bmp" );
 
	SDL_BlitSurface( image, NULL, ecran, NULL );
	SDL_UpdateRect( ecran, 0, 0, 0, 0 );
 
	d.x=0;
	d.y=0;
	d.w=10;
	d.h=10;
	image = SDL_LoadBMP( "P.bmp" );
	SDL_BlitSurface(image, NULL, ecran, &d);
	SDL_BlitSurface( image, NULL, ecran, NULL );
	SDL_UpdateRects(ecran, 1, &d);
	int i=0;
	while(1)
	{
 
		SDL_WaitEvent(&even);
		switch(even.type)
		{
			case SDL_KEYDOWN: 
					move(i,i,&d,image,"P.bmp");
				break;
 
		}
		i++;
	}
 
	return 0;
}
Si quelqu'un pouvait m'aider.
D'avance merci.