zoom factor
This commit is contained in:
@@ -50,6 +50,9 @@ pub struct MapHeader {
|
||||
/// Name of the board-level script in the `[scripts]` table, if any.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub board_script_name: Option<String>,
|
||||
/// Integer tile scale factor. 1 = natural size. Omitted from files when 1 (the default).
|
||||
#[serde(default = "default_zoom", skip_serializing_if = "is_zoom_default")]
|
||||
pub zoom: u32,
|
||||
}
|
||||
|
||||
/// The `[font]` section of a map file, specifying a bitmap font for this board.
|
||||
@@ -150,6 +153,8 @@ pub(crate) struct MapFileObjectEntry {
|
||||
}
|
||||
|
||||
fn default_true() -> bool { true }
|
||||
fn default_zoom() -> u32 { 1 }
|
||||
fn is_zoom_default(z: &u32) -> bool { *z == 1 }
|
||||
|
||||
/// Parses an `"#RRGGBB"` hex color string into an [`Rgba8`].
|
||||
/// Returns opaque black on any parse failure.
|
||||
@@ -282,6 +287,7 @@ impl TryFrom<MapFile> for Board {
|
||||
objects,
|
||||
portals: mf.portals,
|
||||
font,
|
||||
zoom: mf.map.zoom,
|
||||
scripts: mf.scripts,
|
||||
board_script_name: mf.map.board_script_name,
|
||||
})
|
||||
@@ -399,6 +405,7 @@ impl From<&Board> for MapFile {
|
||||
height: board.height,
|
||||
player_start: [board.player.x, board.player.y],
|
||||
board_script_name: board.board_script_name.clone(),
|
||||
zoom: board.zoom,
|
||||
},
|
||||
palette,
|
||||
grid: GridData { content },
|
||||
|
||||
Reference in New Issue
Block a user