[SDL] SDL and multiwindow project...

Bob Pendleton bob at pendleton.com
Fri Sep 23 10:01:54 PDT 2005


On Wed, 2005-09-21 at 09:03 +0200, Marcin Kawelski wrote:
> Hello,
>   I'm working on multiwindowing in SDL. At this moment I implement a 
> simple trick: I've changed location some global variables and put them 
> into struct and then I've created array such structs. It seems to be 
> working, but... there are 2 ends of stick: on one hand I have API 
> without many changes (at the moment I add only one function to public 
> interface), on the other hand this is problematic if you want use SDL in 
> multithreaded application, because this function works like switch 
> which  change  instance of  variables.  It  works , but I think about 
> future of SDL... I want to know if someone had needed to use 
> multiwindowing with SDL before (I read mailing list archives), and what 
> developers think about it, because I think that if we want to do it fine 
> we have to change public API... It is problematic for peoples who use 
> SDL in their applications, and changes only libs... Maybe there are any 
> plans to start new version of SDL (f.g. 1.4.x)??? What do you think 
> about multiwindowing in SDL ???

The proposed API was posted to the list a few weeks ago. You should go
read that discussion under the title "Suggestions needed on multiwindow
implementation for SDL". The problem with multithreading was discussed
at that time.

The trick you describe is pretty much the only way to add multiple
windows to SDL without changing the complete API. As it is, the need to
change the event record to contain a window ID changes the ABI so that a
multiwindow version of SDL can not be binary compatible with any older
version of SDL. We are hoping to see multiple windows in SDL 2.0.

The only other approach is to add the window ID to every SDL function
that depends on a window. That would be a dramatic change to the API and
would require rewriting a huge portion of SDL. The current SDL code is
not really thread safe and making it thread safe would be difficult.
Anyway, there are operating systems (it seems Windows is one) that don't
allow multiple threads to do graphics. At least that is what I have been
told.

		Bob Pendleton

> 
> Sorry about my English ;)
>   Martin Kardigen
> 
> 
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
> 
-- 
+--------------------------------------+
+ Bob Pendleton: writer and programmer +
+ email: Bob at Pendleton.com             +
+ web: www.GameProgrammer.com          +
+ www.Wise2Food.com                    +
+ nutrient info on 7,000+ common foods +
+--------------------------------------+





More information about the SDL mailing list