method
Screen.draw_rectangle
Screen.draw_rectangle(x, y, width, height, color)
Draws just the border of a rectangle — a one-pixel-thick outline — leaving the interior untouched so whatever is behind it shows through. It takes the same top-left position and size as Screen.fill_rectangle, but is meant for framing rather than filling: selection boxes, UI panels, health-bar borders, or highlighting the tile under a cursor. Use it together with fill_rectangle when you want a filled shape with a contrasting edge. Coordinates are in pixels from the top-left of the screen.
Parameters
xthe left edge, in pixels from the left of the screenythe top edge, in pixels from the top of the screenwidththe outline width in pixelsheightthe outline height in pixelscolorthe outline color, e.g. a Color.* name or a 0xRRGGBB literalExample
program SelectionFrame {
property Position { column: int = 0, row: int = 0 }
model Enemy { Position }
const TILE_SIZE: int = 16
handler SpawnEnemy phase Start {
spawn Enemy { Position { column: 6, row: 5 } }
}
handler DrawWorld phase Render {
Screen.clear(Color.MidnightBlue)
for (Position) in query [Position, {Enemy}] {
let pixel_x = Position.column * TILE_SIZE
let pixel_y = Position.row * TILE_SIZE
Screen.fill_rectangle(x: pixel_x, y: pixel_y, width: TILE_SIZE, height: TILE_SIZE, color: Color.Crimson)
Screen.draw_rectangle(x: pixel_x, y: pixel_y, width: TILE_SIZE, height: TILE_SIZE, color: Color.Gold)
}
Screen.show()
}
}