Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
WorldState
Last updated at 2:05 pm UTC on 16 January 2006
What is the responsibility of WorldState?

The class WorldState has the responsibility to implement some or all of the world functions for a PasteUpMorph which for which the message 'isWorldMorph' returns true (implemented as ^ worldState notNil)

Here we see, that a world knows its hands, bounds and a so called step list which is used to animate morphs which register themselves with the world. Actually each morph is steppable, that is, in periodic time steps, the world automatically calls a #step method which most often leads to drawing that morph.

The world is responsible for displaying it all. Morphs never directly draw themselves but simply post requests for redisplay which are collected by the world, optimized and then performed by calling the morphs' drawOn: methods. The world knows how often this should happen at most. Between each redisplay, all events of all hands are processed.

Note:A WorldState object responds to the messages
In the stepList the submorphs which need regularly the message send step are kept.
See also When are the deferred UI messages processed?

Note: It seems that Morphic is a very interesting simulation framework. See for example the ant's colony project of Alan Kay on Bob's Super Swiki.

How do I set the stepping interval?
It looks like in your Morph subclass you override stepTime. So FooMorph>>#step might look like
stepTime
^ 1000.

if FooMorph only wanted to be painted every second. – Frank Shearar