Preparing GravityLoops for simulation
I'm making progress with GravityLoops, my gravity simulator in Interlisp and LOOPS. There is nothing to see yet but my latest work put in place most of the pieces the program needs to show something on the screen.
The major new feature is class UniverseDisplay which will animate in a window the motions of the simulated bodies. UniverseDisplay specializes class Window, a LOOPS wrapper around Interlisp windows. The rest of the user interface, such as a command menu and input dialogs, will grow from there.
Along with a visible window UniverseDisplay manages an offscreen buffer, a display stream associated with a bitmap where all the drawing takes place. To reduce flicker and improve fluidity, at each simulation cycle the code will blit the updated buffer to the window. Method UniverseDisplay.ShowBuffer blits the buffer to the window, UniverseDisplay.ClearDisplay clears the buffer. Method Body.Update, also part of the latest work, computes the new position of a body and draws it to the buffer.
Everything is in place to flesh out Universe.Simulate that runs the simulation loop. The method will call Body.ApplyForce to compute the changes of the physical parameters of a body under the gravitational influence of another, and Body.Update to compute the new position and draw the body.
#GravityLoops #Interlisp #Lisp
Discuss... Email | Reply @amoroso@oldbytes.space