StructOp/bracket-lib
Build terminal games in Rust with bracket-lib.
Versions2.0.0
Use this provider
Add this declaration to your project and run structop init. Registry access and version locks
intent.st
structop {
type_app { exec = { lang = "Rust" } }
lib_provider {
core = { source = "StructOp/rust", version = "@latest" }
package = { source = "StructOp/bracket-lib", version = "2.0.0" }
}
}Example
Draw and move a player in a terminal
Provider types
| Type | Kind | Values or native type |
|---|---|---|
Key | enum | none, left, right, up, down, space, enter, escape, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, key0, key1, key2, key3, key4, key5, key6, key7, key8, key9 |
Color | enum | black, white, grey, red, green, yellow, blue, navy, magenta, cyan |
Declaration reference
ability "game"
| Name | Type | Use |
|---|---|---|
| title | String | Optional · plain = true |
| width | Expression Int | Optional |
| height | Expression Int | Optional |
| fps | Expression Int | Optional |
| key | VarRef Key | Optional |
| frame_ms | VarRef Float | Optional |
| on_tick | AbilityList | Required |
ability "clear"
| Name | Type | Use |
|---|---|---|
| background | Expression Color | Optional |
ability "draw"
| Name | Type | Use |
|---|---|---|
| x | Expression Int | Required |
| y | Expression Int | Required |
| glyph | Expression Char | Required |
| color | Expression Color | Optional |
| background | Expression Color | Optional |
ability "text"
| Name | Type | Use |
|---|---|---|
| x | Expression Int | Optional |
| right | Expression Int | Optional |
| y | Expression Int | Required |
| message | String | Required |
| color | Expression Color | Optional |
| background | Expression Color | Optional |
ability "quit"
No attributes.
ability "bar"
| Name | Type | Use |
|---|---|---|
| x | Expression Int | Required |
| y | Expression Int | Required |
| width | Expression Int | Required |
| value | Expression Int | Required |
| max | Expression Int | Required |
| color | Expression Color | Optional |
| background | Expression Color | Optional |