Tiles
Tiles are used to build scripts by direct manipulation rather than by typing source code.
Using Tiles
(user documentation to be written)
The Tile Architecture
The major components of the tile scripting architecture are definitions, tiles, and costumes:
- Tile Definitions: The meta information for each tile. To create a new tile, make a new definition.
- Tile Players: The tile players form a tree representing a script. When any tile is changed, a parse tree is generated from the tile tree and compiled.
- Tile Costumes: The tile player tree is rendered and manipulated through tile costumes. Whenever something is changed in the players, the costumes automatically adapt.
Other noteworthy concepts include:
- Tile Value Types: Arguments and return values are typed, to support different visual representations and editing as well as drag-and-drop operations.
- Tile Library: The tile library provides a level of indirection between the tiles and their costumes, to enable using other than the default costumes.
How to make a new tile
- Create a new definition for it.
- Currently, this means adding to the CTileDefinition's defaultViewerSpec, which contains serialized tile definitions.
How to make a new tile type
- Create a subclass of CTileType.
- If you want to choose from a given list of values, subclass CEnumType (see CSoundNameType for an example). If it's a list of symbols, subclass CSymbolType.
- To map from a given object to a tile type, extend CTileType>>defaultTileTypeFor:
- To map from a tile type to a particular tile costume, extend CTileLibrary>>valueTileForType:
- Possibly, create a new costume class for presenting tiles of this type (see CColorTileCostume for an example)
- If you need to serialize the default value of your new type, implement #read: and #print:
References to other players
In compiled scripts, other players are referenced through a runtime lookup mechanism, see CObject>>lookup: and CObject>>lookupSpecFor: