Files
kryon/examples/tilemap/tilemap.zi
T

27 lines
1.1 KiB
Ziran

Text :: #import "kryon/text";
TileMap :: #import "kryon/tile_map";
#import "kryon/geometry"
#import "kryon/session"
#program_export
Frame :: (session: Session, viewport: Rectangle) -> s32 {
Text.Draw(session, Text.Props.{.disabled = example_disabled, .key = 1, .bounds = .{viewport.x + 20.0, viewport.y + 16.0, viewport.width - 40.0, 40.0}, .text = "Tile map", .size = 28})
bounds := Rectangle.{viewport.x + 20.0, viewport.y + 76.0, viewport.width - 40.0, 180.0}
tiles := string.["assets/pfp.webp"]
names := string.["Portrait"]
cells := s32.[0, -1, 0, -1, 0, -1, 0, -1, 0]
TileMap.Draw(session, TileMap.Props.{.key = 10, .bounds = .{bounds.x, bounds.y, bounds.width, viewport.height - 96.0}, .columns = 3, .rows = 3, .tiles = tiles[:], .names = names[:], .layers = cells[:], .layer_count = 1, .label = "Picture tiles", .pixel_snap = true})
return 0
}
example_disabled: bool;
example_reduced_motion: bool;
// Hosts publish these options before the unchanged application entry point.
#program_export
SetExampleOptions :: (disabled: bool, reduced_motion: bool) {
example_disabled = disabled
example_reduced_motion = reduced_motion
}