Load maps from TOML files with XPM-style palette
Introduces a map file format: TOML with a [palette] mapping characters to (Glyph, Element) definitions and a [grid] multi-line string. Board now owns the player position, objects, and portals. map_file::load() deserializes a file and converts it to a Board via From<MapFile>. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
[map]
|
||||
name = "Starting Room"
|
||||
width = 60
|
||||
height = 25
|
||||
player_start = [30, 12]
|
||||
|
||||
[palette]
|
||||
" " = { passable = true, ch = " ", fg = "#000000", bg = "#000000" }
|
||||
"#" = { passable = false, ch = "#", fg = "#808080", bg = "#606060" }
|
||||
|
||||
[grid]
|
||||
content = """
|
||||
############################################################
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# ###### #
|
||||
# # #
|
||||
# # #
|
||||
# # #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
# #
|
||||
############################################################
|
||||
"""
|
||||
Reference in New Issue
Block a user