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 4:22 pm UTC on 7 May 2019
What is the responsibility of WorldState?

The class WorldState has the responsibility to implement some or all of the world functions for a PasteUpMorph object which plays the role of a world.

This is the case if the PasteUpMorph object answers the message
 isWorldMorph 
with true.

This message is implemented as
^ worldState notNil

Such a PasteUpMorph object then has a WorldState object.
Other PasteUpMorph instances do not have a WorldState instance.
For example BookMorphs use PasteUpMorphs as pages. The pages morphs do have nil for the worldstate variable.


A world knows its hands, bounds and a so called step list.
The step list keeps the morphs which need to be animated. To get into this list a morph has to register itself with the world.

Each morph is steppable. The world object regularily calls the #step method.

The world is responsible for displaying morphs.

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?

How do I set the Morph stepping interval?_____

See also
Drawing
Morphic as a simulation framework.


Example of message dispatching, the number in square brackets is the oop.
(The output was generated by using #traceRM:levels: of BabySRE (SRE Execution Tracer).
1  [3921] : MyEllipseMorph >> mouseDown: {[3921]a MyEllipseMorph}
2  [3921] : MyEllipseMorph >> handleMouseDown:
3  [3272] : MouseButtonEvent >> sentTo:
4  [3921] : MyEllipseMorph >> handleEvent:
5  [1549] : MorphicEventDispatcher >> dispatchMouseDown:with:
6  [1549] : MorphicEventDispatcher >> dispatchEvent:with:
7  [3921] : MyEllipseMorph >> processEvent:using:
8  [1549] : MorphicEventDispatcher >> dispatchMouseDown:with:
9  [1549] : MorphicEventDispatcher >> dispatchEvent:with:
10  [1763] : PasteUpMorph >> processEvent:using:
11  [1763] : PasteUpMorph >> processEvent:using:
12  [1763] : PasteUpMorph >> processEvent:
13  [1869] : HandMorph >> sendEvent:focus:clear:
14  [1869] : HandMorph >> sendMouseEvent:
15  [1869] : HandMorph >> handleEvent:
16  [1869] : HandMorph >> processEvents
17  [3942] : WorldState >> doOneCycleNowFor:
18  [2934] : Array >> do:
19  [3942] : WorldState >> handsDo:
20  [3942] : WorldState >> doOneCycleNowFor:
21  [3942] : WorldState >> doOneCycleFor:
22  [1763] : PasteUpMorph >> doOneCycle
23  [2445] : Project class >> spawnNewProcess
24  [284] : BlockContext >> newProcess


See also

World PasteUpMorph object (data structure)