textmode.js / TextmodeGrid
Class: TextmodeGrid
Grid used by a textmode layer.
The grid determines how characters are positioned and sized. By default, it is responsive and recalculates columns and rows from the canvas size and glyph cell size.
You can manually set cols and rows to lock the grid to a specific size.
Example
Accessors
| Accessor | Description |
|---|---|
| cellHeight | Height of each cell in screen pixels. |
| cellWidth | Width of each cell in screen pixels. |
| cols | Number of columns in the grid. |
| height | Total grid height in screen pixels. |
| offsetX | Horizontal offset in pixels from the canvas edge to the grid. |
| offsetY | Vertical offset in pixels from the canvas edge to the grid. |
| rows | Number of rows in the grid. |
| width | Total grid width in screen pixels. |
Methods
| Method | Description |
|---|---|
| reset | Recalculate columns and rows from the current canvas and cell dimensions. |
| responsive | Restore responsive sizing so subsequent canvas resizes recompute columns and rows. |