Hi all,
I again !!!
So I explain my problem :
I put a background on a buffer, then I draw some lines on this buffer
and I update than the all screen !
Then I want to move a sprite on this screen, but until now I’m obliged
to updating the all screen ecah tim I move my sprite !
So when I press the keyboard repeatedly it becomes slow although my
machine is a 450 Mhz with 64 Ram.
So my question is How to update just a part of the screen ?
In fact I will update just the rect where my sprite was before leaving
is place !!!
I hope my poor english won’t stop you helping me !!!
Bye
Sylvain
You can update a part of the screen like this (for example only a 32x32
block at top left):
SDL_Surface *screen;
SDL_Rect dest;
...
dest.x = 0;
dest.y = 0;
dest.w = 32;
dest.h = 32;
SDL_UpdateRects(screen, 1, &dest);
All the best,
robOn Thu, Mar 23, 2000 at 09:08:28AM +0000, Sylvain.Hellegouarch + etud.sir.a1 wrote:
So my question is How to update just a part of the screen ?
In fact I will update just the rect where my sprite was before leaving
is place !!!
Read the API reference on SDL_UpdateRect() and SDL_UpdateRects()–
Brian
On Thu, 23 Mar 2000, Sylvain.Hellegouarch + etud.sir.a1 wrote:
Hi all,
I again !!!
So I explain my problem :
I put a background on a buffer, then I draw some lines on this buffer
and I update than the all screen !
Then I want to move a sprite on this screen, but until now I’m obliged
to updating the all screen ecah tim I move my sprite !
So when I press the keyboard repeatedly it becomes slow although my
machine is a 450 Mhz with 64 Ram.
So my question is How to update just a part of the screen ?
In fact I will update just the rect where my sprite was before leaving
is place !!!
I hope my poor english won’t stop you helping me !!!
Bye
Sylvain
Yes I know that :), actually, ok i will try to explain well :
I’ve put an image on the screen and I update the screen with
SDL_UpdateRect(), but after when I move my sprite I don’t want it to leave
his trace on the screen, it is moving !!! So to do that I call in my
function which actualize the screen each time the sprite move, the function
which Update the entire screen, but it’s slow !!! So instead of calling the
function which update the all screen, I would like to call a function which
update just the part where the sprite was before its moving !!! I think it
will be more efficient and quicker !!!
But maybe I must do it in an another way ?
Bye
Sylvain
Robert Linden a ?crit dans le message :
20000323111619.A370 at nosferatu.id-pro.net…> On Thu, Mar 23, 2000 at 09:08:28AM +0000, Sylvain.Hellegouarch + etud.sir.a1 wrote:
So my question is How to update just a part of the screen ?
In fact I will update just the rect where my sprite was before leaving
is place !!!
You can update a part of the screen like this (for example only a 32x32
block at top left):
SDL_Surface *screen;
SDL_Rect dest;
...
dest.x = 0;
dest.y = 0;
dest.w = 32;
dest.h = 32;
SDL_UpdateRects(screen, 1, &dest);
All the best,
rob