Watchmaker Pascal Source Second Edition - Aronnax9000/WatchmakerSuite GitHub Wiki

Drawing (Monochrome Biomorphs)

The entry point for drawing Monochrome Biomorphs is called "Delayvelop". The procedure is called with a reference to the biomorph to be drawn (its genome data and the Pic which it owns), and the point at which the biomorph is to be drawn, called "Here".

Delayvelop starts by calling Develop with the same parameters (the biomorphs' Person struct and the point where drawing is to take place). A value of true is passed for the ZeroMargin parameter, which results in the "Margin" global being initialized to an infinitely small rectangle centerd on the point "Here".

After Develop returns, Delayvelop examines the value of the global "Margin" rectangle. It sets the local integer variable "margcentre" to the vertical midpoint of the Margin rectangle. "Offset" is then set to the difference between Margin's vertical midpoint and the vertical component of Here. The top and bottom of Margin are then moved upwards by the value of "Offset".

Then, an offset point, called "OffCentre", is calculated. The horizontal component of OffCentre is the same as the horizontal component of Here, meaning that the routine does not calculate a horizontal offset. The vertical component of OffCentre is the vertical component of "Here", moved upwards by the value of Offset.

Finally, Delayvelop calls DrawPic with the global Pic variable "MyPic", the OffCentre point, and the biomorph.