GetLayerWidth
From Spheriki
Get's the width of the specified layer in tiles.
Contents |
[edit]
Usage
number GetLayerWidth(layer);
- layer Number, non-negative. Index of the layer to check the width of.
[edit]
Examples
For this example to work, the variable f must have been previously loaded with a Sphere Font object. Place this in the renderscript of a map using the Sphere IDE map editor.
f.drawText(0, 0, "layer width (0) = " + GetLayerWidth(0));
This will show the width of the bottom layer of the map in the top-left corner of the screen.
[edit]
Notes
- The valid range of layers that this function will accept is between 0 (inclusive) and GetNumLayers() (exclusive).
- The number returned by this function is the width of the currently loaded map in tiles, not pixels. To return the pixel width, find the pixel width of a single tile image and multiply it by the number returned by GetLayerWidth.
- This function will only work while the map engine is running.
[edit]
See also
- Font.drawText()
- GetTileImage()
- Sphere Font object

