• Advertisement
Sign in to follow this  

Hardware surfaces problem

This topic is 4515 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Whenever I use SDL_HWSURFACE and SDL_DOUBLEBUF as a parameter in SDL_SetVideoMode, SDL_FillRect doesn't work and so my moving sprite leaves a trail. My code looks somewhat like this:

SDL_Surface* screen;

void Init()
{
screen = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);

// etc...
}

void Render()
{
// blah blah blah

SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));

// draw sprite...

// blah blah blah
}
[Edited by - geekalert on October 10, 2005 12:45:39 PM]

Share this post


Link to post
Share on other sites
Advertisement
Is that the correct syntax for SDL_MapRGB? Been a while since I used SDL, so I might be missing something, but it seems to me like that NULL shouldn't be there. Another thing I can think might be causing it is where you flip the video surface.

Hope that helps!

Share this post


Link to post
Share on other sites
I guess I answered my own question. I moved the SDL_FillRect call to the outside of the SDL_Lock and SDL_Unlock pair, as dictated by the manual.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement