[Fluxus] wait?
David Griffiths
dave at pawfal.org
Fri Jan 7 00:26:45 PST 2011
Hi Kassen,
On Fri, 2011-01-07 at 01:34 +0100, Kassen wrote:
> The thing is; I remembered there were ways to make scheme threads
> wait. What I would like to do is clear, then put a image or text on
> the screen, then actually render that for a frame, then continue
> parsing rather a lot of code that loads a fair amount of objects and
> textures. Essentially I want a "loading" screen at (re)compiling and I
> can't figure out a way to do that.
>
>
> It seems that the renderer is in the same thread that my code is in
> and so won't render before my code is done.
There are two things here. If you want to run a thread that blocks in
the background while another thread updates the screen with smooth
animation, then I think the answer is no - fluxus is single threaded (in
os terms). I think there are moves to add os level concurrency to
racket, but I haven't been keeping a close eye on developments there.
If you want to use racket threads to sequence execution so you can
display a loading screen first, then this should be possible. You can
use (sleep).
I've not needed to use threads for this purpose though, it's usually
sufficient to have a kind of state machine in operation - eg:
title screen ---> menu screen -----
^ \
\ /
--- game <-
With each mode responsible for loading and setting itself up, as well as
cleaning itself up before entering a new mode.
I can try and dig out a concrete example if you like.
cheers,
dave
More information about the Fluxus
mailing list