pict3d
pict3d copied to clipboard
a way to create a big-bang3d world as a child of an existing frame (or other gui obj)?
Is there a way to create a big-bang3d world as a child of an existing frame (or other gui obj), and if not, could an option for that be added?
I'm thinking about this because I wanted to add a scoring system to my-unpossible where it would display the current score in the same window as the big-band3d world.
That's an interesting way to work around two current limitations: Pict3D doesn't have a way to do 2D yet, nor can it render in layers. (It will eventually.)
Rather than adding a parameter to big-bang3d
, I think I'd rather provide the canvas that big bang programs run on, and let users use it to control how programs run and render.
But would that allow a big-bang-like interface?
I think so. A big-bang3d
-like function could return a canvas, which could have start
and stop
methods that receive and return the game state, and possibly methods for changing parameters like #:frame-delay
.
As far as remaining purely functional goes, that kind of gets thrown out the window as soon as you do GUIs in Racket, so I'm not worried about it.
What do you mean? Do you mean that you would make another big-bang3d-like function that takes a parent gui object in addition to the normal #:on-draw etc, and returns a canvas immediately, which would then require a call to a start method? Or were you thinking of something else?
But for purely functional, the handlers for updating the world-state and drawing the scene would still be functional, right? And the start method would be imperative? But does it even need a start method, or could it use something like on-superwindow-show
to do that? And without that, does it even need to return a canvas in the first place?
Unless you want to provide imperative methods for other reasons, returning a canvas shouldn't be necessary, or am I wrong? So then the new big-bang3d-like function would behave exactly like the current big-bang3d function except with this extra argument, so then you might as well make it an optional argument to the current big-bang3d function?