[SDL] Re: Feature Query System (Was: Some multithreaded improvement to the event queue...)

Rainer Deyke rainerd at eldwood.com
Fri Sep 30 19:53:27 PDT 2005


Brian Raiter wrote:
> Yes, but surely you'd agree that that's not a good, portable
> solution. SDL_WM_ToggleFullScreen may become usable on other platforms
> in the future (and/or it might conceivably become unavailabile on
> later versions of the current platform). It would definitely be better
> if you could test for the feature directly, rather than hardcode an
> assumption that it exists on one platform.

I agree that conditional compilation is not the answer to this 
situation.  However, what's wrong with just trying 
SDL_WM_ToggleFullScreen falling back to SDL_SetVideoMode if it fails? 
The only situation I can think of where that wouldn't work is if you 
didn't write the fallback code and want to disable the ability to switch 
between full-screen and windowed mode entirely.

> SDL already uses this idea with the SDL_MUSTLOCK() macro. Having
> a similar feature for features like full-screen toggling would be a
> good thing, I think.

For the record, I consider SDL_MUSTLOCK() a mistake.  90% of the time it 
is used for code like this:

if (SDL_MUSTLOCK(s)) SDL_LockSurface(s);

...which is just a waste of keystrokes, since SDL_LockSurface(s) works 
even if SDL_MUSTLOCK(s) returns false.  I can think of two legitimate 
uses, one of which is purely for error checking 
(assert(!SDL_MUSTLOCK(s))) and the other is completely marginal (i.e. 
completely different code paths optimized for the different performance 
characteristics of surfaces that require locking and those that don't).

Which is not to say that a query system wouldn't be a worthwhile 
addition to SDL.  However, it would need to be carefully designed to 
expose useful information instead just opening up a bunch of useless 
implementation details.


-- 
Rainer Deyke - rainerd at eldwood.com - http://eldwood.com





More information about the SDL mailing list