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

Elden Armbrust earmbrust at xero-soft.com
Fri Sep 30 22:00:30 PDT 2005


I think Rainer is right about the query system, and how it should not 
open up a bunch of useless things.  In addition to that, I think that 
*if* this is added to SDL, it should likely be in the form of an addon 
library, and should be kept as streamlined as possible.  SDL is built 
the way it is for a reason.  Anyone can make additions to SDL through a 
library without it even having to be checked into a CVS/SVN server, or 
approved by a larger audience.  I can almost guarantee (and anyone who's 
even visited the freenode irc channel can likely verify) that newbies 
with no idea of what they're doing would misuse the functions to the 
point where they'd come crying to us to figure out why their program is 
slowing down, not working "the way it should", or just generally saying 
that there's too much to learn. (Yes, I've actually heard that about 
SDL...*shudder*)  I think the big thing here is that whoever wants these 
features added should really put in the effort and either at least try 
to submit a patch which covers some of the functionality, or create an 
addon library (the better option, in my opinion) that does the job.  If 
we just sit back and complain about what SDL can't do, rather than 
adding that functionality for ourselves and others, we do nothing to 
help a great development tool/library such as SDL.

-Elden


Rainer Deyke wrote:

> 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.
>
>






More information about the SDL mailing list