some docs tweaks
This commit is contained in:
parent
2546a5327f
commit
f24c7d2715
@ -40,7 +40,18 @@ Console.setCursorVisible(true)
|
|||||||
Console.flush()
|
Console.flush()
|
||||||
```
|
```
|
||||||
|
|
||||||
Interactive sample script in this repo:
|
#### Tetris sample
|
||||||
|
|
||||||
|
The repository includes a full interactive Tetris sample that demonstrates:
|
||||||
|
|
||||||
|
- alternate screen rendering
|
||||||
|
- raw keyboard input
|
||||||
|
- resize handling
|
||||||
|
- typed console events
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Run it from the project root in a real TTY:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
lyng examples/tetris_console.lyng
|
lyng examples/tetris_console.lyng
|
||||||
@ -50,7 +61,7 @@ lyng examples/tetris_console.lyng
|
|||||||
|
|
||||||
- `Console.isSupported(): Bool` — whether console control is available on this platform/runtime.
|
- `Console.isSupported(): Bool` — whether console control is available on this platform/runtime.
|
||||||
- `Console.isTty(): Bool` — whether output is attached to a TTY.
|
- `Console.isTty(): Bool` — whether output is attached to a TTY.
|
||||||
- `Console.ansiLevel(): String` — `NONE`, `BASIC16`, `ANSI256`, `TRUECOLOR`.
|
- `Console.ansiLevel(): ConsoleAnsiLevel` — `NONE`, `BASIC16`, `ANSI256`, `TRUECOLOR`.
|
||||||
- `Console.geometry(): ConsoleGeometry?` — `{columns, rows}` as typed object or `null`.
|
- `Console.geometry(): ConsoleGeometry?` — `{columns, rows}` as typed object or `null`.
|
||||||
- `Console.details(): ConsoleDetails` — consolidated capability object.
|
- `Console.details(): ConsoleDetails` — consolidated capability object.
|
||||||
- `Console.write(text: String)` — writes to console output.
|
- `Console.write(text: String)` — writes to console output.
|
||||||
@ -81,9 +92,9 @@ launch {
|
|||||||
|
|
||||||
#### Event format
|
#### Event format
|
||||||
|
|
||||||
`Console.events()` emits `ConsoleEvent` with at least:
|
`Console.events()` emits `ConsoleEvent` with:
|
||||||
|
|
||||||
- `type: String` — `resize`, `keydown`, `keyup`
|
- `type: ConsoleEventType` — `UNKNOWN`, `RESIZE`, `KEY_DOWN`, `KEY_UP`
|
||||||
|
|
||||||
Additional fields:
|
Additional fields:
|
||||||
|
|
||||||
|
|||||||
BIN
site/src/jsMain/resources/tetris.png
Normal file
BIN
site/src/jsMain/resources/tetris.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 115 KiB |
Loading…
x
Reference in New Issue
Block a user