Tricky color cursors

Emil Brink d94-ebr at nada.kth.se
Fri Apr 24 01:38:48 PDT 1998



On Fri, 24 Apr 1998, Sam Lantinga wrote:

[doing my own mouse cursor]
> What you would end up doing is:
> 
> 	if ( SDL_MUSTLOCK(screen) ) {
> 		if ( SDL_LockSurface(screen) < 0 )
> 			return;
> 	}
> 	write write write a frame
> 	if ( SDL_MUSTLOCK(screen) ) {
> 		SDL_UnlockSurface(screen);
> 	}
> 	SDL_GetMouseState(&x, &y);
> 	blit mouse sprite
> 	SDL_UpdateRect(0, 0, 0, 0);
> 
> Actually, it would be faster just to let SDL handle it.
> You either have to clip the cursor yourself or let SDL clip it in which
> case it's just as easy to let SDL do the work.  I dunno.  The gains don't
> seem very high, especially when SDL can do it for you, and the codepaths
> are designed to do so.  

OK, OK, OK! I give up! I will never, ever again contemplate doing the
mouse cursor myself! Happy? :^) Umm... This SDL_MUSTLOCK()-talk, does
it mean that I must lock a surface even if I'm only going to do
SDL_BlitSurface() on it when I write my frame?

> If you have a black and white cursor, the window manager cursor is used 
> whenever possible, though in constant-refresh conditions there's usually 
> a lot of flicker.

Seen that. Didn't like it much. Turned the cursor off. :)

/Emil





More information about the SDL mailing list