layer[]
The layers containing entity graphics defined for the graphic window. This array is a subset of the general layer array for the window window.layers[].
Each vector layer has an associated group identififier. Entities within the group therefore constitute the contents of the layer.
This array is closely linked to the window.group_order attribute of the window, in fact the group order was the crude layering system available in Fire prior to Version 7. Whenever a group is added to or removed from the group order, a corresponding vector layer is created or destroyed. Alternatively when a change is made to a vector layer, a similar change is made to the group order.
As mentioned already vector layers provide a subset of the general layer array for the window, and are always renedered after the background layer, cloth layers and pre-vector layer, but before the post-vector layer.
A new graphic window initially has 2 layers, a background layer, and a default vector layer associated with the all group of entities. This is no change from earlier Fire versions, but merely provides a default layering system. The background layer is merely for the convenience of accessing and controlling the background color and possibly a background image.
Vector layers can be created by one of 2 methods:
by adding the group of entities which constitute the layer to the window.group_order array, e.g.
group buildings window gwin = wgraphic gwin.group_order = <all, buildings>or by extending the window.layers array and then assigning a group to the new array element, e.g.
group buildings window gwin = wgraphic gwin.layers[3] := null;# Add an undefined layer gwin.layers[3].group = buildings;# Make the layer a vector layer
The layer draw order can be changed merely by re-ordering the window.vector_layers array (or the superset window.layers array). The swap operator is particularly useful for layer re-ordering, e.g.
gwin.vector_layers[3] <=> gwin.vector_layers[4]
Commands: |
|
Structures: |