[SDL] FLTK and SDL two windows
Taylor "Assbone" Peterson
assbone at gmail.com
Sat Feb 3 12:52:32 PST 2007
I'm using FLTK 1.1.x. I'm looping FLTK with FL::run().
I'm just starting to learn how to use FLTK. This is how I have it set up:
void make_window();
main(){
make_window();
SDL LOOP
return FL::run
}
void make_window(){
FLTK STUFF
}
I'm not sure what you mean by threads and threading '_'.
Thanks,
Taylor
On 2/3/07, Alvin <alvinbeach at gmail.com> wrote:
>
> On Saturday 03 February 2007 12:52:51 Taylor "Assbone" Peterson wrote:
> > Hey guys I'm having a problem with SDL and FLTK.
> >
> > I have it so that FLTK pops up a text box in its own window and SDL has
> its
> > own window for the main game. The problem is that in the SDL window
> (with
> > the FLTK window open) the game lags behind. And in the FLTK window (
> with
> > the SDL window open) nothing in the FLTK window works. Anyone know the
> > cause of this?
> >
> > Thanks,
> > Taylor
>
> What version of FLTK? 1.1.x or 2.0? What OS?
>
> I'll assume FLTK 1.1.x because that's what I use. ;)
>
> What are you doing to run the FLTK loop? Are you using Fl::run() or are
> you
> looping on Fl::wait()?
>
> Are you performing the SDL operations (e.g. checking for SDL events,
> blitting,
> etc.) in the same thread/process as you are running the fltk loop?
>
> I have done something similar to what you have described. What I did was
> in
> main() I do "return Fl::run()". Then in the main FLTK window (I'll call
> this
> the GUI) an SDL_Surface is created in the standard way a SDL surface is
> initially created. The SDL surface is usually a member of the GUI and is
> created in the GUI's ctor. After the SDL surface is created, a thread is
> created using the SDL surface as it's parameter. This thread is
> responsible
> for all the SDL operations. The GUI and SDL thread communicate via a mutex
> and/or FLTK's threading support (e.g. Fl::lock(), Fl::awake(),
> Fl::unlock()).
> The synchronisation method depends on which way the communication will
> travel.
>
> For the thread, I use pthreads but it probably makes more sense to use
> SDL's
> Threading support.
>
> If you don't want to use another thread, take a look at Fl::add_check().
> That
> could work? The function you pass to Fl::add_check() would be responsible
> for
> all the SDL operations. The fltk loop will then call this function
> automagically for you while it is looking for its own events and
> redrawing,
> etc. I don't know if this would be slow though. I guess it depends on the
> SDL
> operations you are doing.
>
> Alvin
>
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
--
+---------------------+
|http://commabunny.com|
| |
|cout<<"Hello, noob!";|
+---------------------+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20070203/371fcfd5/attachment-0001.htm
More information about the SDL
mailing list