[SDL] Better performance needed - am I doing this right?
Colin Tuckley
colin at tuckley.org
Wed Jun 6 12:36:57 PDT 2007
Eddy L O Jansson wrote:
> Even so, I'd be chocked if this wasn't an update issue. Do you have just the one SDL_Flip in your code?
I've got several SDL_Flip calls, one in each logical screen update section.
I've done a bit more investigation and found that the time hog was the
cursor undraw/draw routine. I've changed the SDL_Flip in that to an
SDL_UpdateRect of the correct size and that has helped a lot.
It was only doing one SDL_Flip for drawing all the digits of the number, but
it was doing 4 more for the cursor moves.
> You can use Uint32 SDL_GetTicks(void) to track the relative time spent doing different tasks.
I just tried this, it's too coarse, I get the same tick number right through
drawing a character, bliting and updating.
> One thing, if you are going to fiddle with ->pixels,
> don't forget to add if( SDL_MUSTLOCK(surface) ) SDL_LockSurface(surface)
> and the corresponding SDL_UnlockSurface() when you're done.
Is this really necessary if I'm not using Hardware surfaces?
regards,
Colin
--
Colin Tuckley | colin at tuckley.org | PGP/GnuPG Key Id
+44(0)1903 236872 | +44(0)7799 143369 | 0x1B3045CE
It is well known that Discworld trolls loose intelligence as they warm up.
Does this mean that a particularly hot headed troll would be a lava lout?
More information about the SDL
mailing list