StructOp Handbook
Contents Examples Commands

Dungeon player

Terminal game284 lines of .st437 lines of generated Rust
Last screen
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
......................................@.........................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
................................................................................
On this page

The .st files#

intent.st
structop {
    type_app {
        exec = {
            lang = "Rust"
        }
    }

    lib_provider {
        core = {
            source  = "StructOp/core"
            version = "@latest"
        }
        Screen = {
            source  = "StructOp/game"
            version = "@latest"
        }
    }
}

Input, plan and generated Rust#

input.txt · key script, one line per frame (4 lines)
input.txt · key script, one line per frame (4 lines)
left
left
up
structop plan
structop plan
  # program.app will be created
  + program.app (.structop/build/app)
      + ability.call.NewMap
      + ability.game.Dungeon
      + ability.clear.Screen
      + ability.call.Update
      + ability.call.Render
      + ability.call.RenderPlayer
      + ability.enum.TileType
      + ability.function.map_idx
      + ability.function.new_map
      + ability.for.Fill
      + ability.set.Floor
      + ability.function.render_map
      + ability.for.Rows
      + ability.for.Columns
      + ability.switch.Tile
      + ability.draw.FloorTile
      + ability.draw.WallTile
      + ability.function.in_bounds
      + ability.function.can_enter_tile
      + ability.function.try_idx
      + ability.set.NoIdx
      + ability.if.Inside
      + ability.set.SomeIdx
      + ability.struct.Point
      + ability.function.render_player
      + ability.draw.Player
      + ability.function.update_player
      + ability.switch.Move
      + ability.set.Left
      + ability.set.Right
      + ability.set.Up
      + ability.set.Down
      + ability.set.Zero
      + ability.set.NewPosition
      + ability.if.CanEnter
      + ability.set.Position
      + ability.value.tiles
      + ability.value.player
      + ability.value.key

Plan: 1 to add, 0 to change, 0 to destroy.
Generated main.rs

To inspect this generated file, select Rust in intent.st, initialize the project and export its source.

Export locally
structop init
structop apply -source -no-run
Try it
cd rust-dungeon-player    # a folder holding the .st files above
structop init
structop plan
structop apply