Morphic already provides this main loop. It is in the MorphicProject class>>spawnNewProcess :
uiProcess := [ [ world doOneCycle. Processor yield ] repeat. ] newProcess ...
And if you dig in doOneCycle , you will find it
- (optional) makes a delay (
interCyclePause: - checks screen size
- handles events
step processes- displays the world
Your code should connect to these steps by adding mouse / keyboard event handlers, step methods for animation, and drawing methods for re-rendering. All this should be methods in your own game. You can find examples throughout the system.
source share