Ok, I have a weird function. Here it is:
void Slock(SDL_Surface *screen) //1
{
if ( SDL_MUSTLOCK(screen) ) //2
{
if (SDL_LockSurface(screen) < 0 ) //3
{
return;
}
}
}
1) Slock is called when the screen must be locked so it can be drawn on
2) SDL_MUSTLOCK(surface, in this case 'screen') determines if the screen does in fact need to be locked (it may already be locked or not require being locked in order to be drawn on)
3) If SDL_MUSTLOCK determines that the screen must be locked it then goes to the next if statement which says if SDL_LockSurface(screen) is an error then return. It doesn't seem SDL_LockSurface is ever actually called though, so I don't see how it can test if it is an error or not
Ok, this is kinda weird so any help will be great. By the way all the SDL functions return less than zero (< 0) when it is an error.
If someone can attempt to explain to me why it is set up the way it is I will be very happy. By the way this source code actually works, it is from a SDL tutorial online I am just trying to understand it.
thanks in advanced



LinkBack URL
About LinkBacks



