StructOp Handbook
Contents Examples Commands

StructOp/curses

Read keys and draw frames in a terminal with ncurses.

COfficial providerPublished by StructOp
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 = "C" } }
    lib_provider {
        core = { source = "StructOp/c", version = "@latest" }
        package = { source = "StructOp/curses", version = "2.0.0" }
    }
}

Example

Draw and move a player in a terminal This example selects Rust in its intent file. Select C to use curses.

Provider types

TypeKindValues or native type
Keyenumnone, 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
Colorenumblack, white, grey, red, green, yellow, blue, navy, magenta, cyan

Declaration reference

ability "game"
NameTypeUse
titleStringOptional · plain = true
widthExpression IntOptional
heightExpression IntOptional
fpsExpression IntOptional
keyVarRef KeyOptional
frame_msVarRef FloatOptional
on_tickAbilityListRequired
ability "clear"
NameTypeUse
backgroundExpression ColorOptional
ability "draw"
NameTypeUse
xExpression IntRequired
yExpression IntRequired
glyphExpression CharRequired
colorExpression ColorOptional
backgroundExpression ColorOptional
ability "text"
NameTypeUse
xExpression IntOptional
rightExpression IntOptional
yExpression IntRequired
messageStringRequired
colorExpression ColorOptional
backgroundExpression ColorOptional
ability "quit"

No attributes.

ability "bar"
NameTypeUse
xExpression IntRequired
yExpression IntRequired
widthExpression IntRequired
valueExpression IntRequired
maxExpression IntRequired
colorExpression ColorOptional
backgroundExpression ColorOptional