diff --git a/src/main.rs b/src/main.rs index cf265d7..4458307 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,20 @@ use bevy::{prelude::*, window::WindowResolution}; use bevy_ecs_tilemap::prelude::*; -const MAP_SIZE: TilemapSize = TilemapSize { x: 50, y: 25 }; -const TILE_SIZE: TilemapTileSize = TilemapTileSize { x: 25.0, y: 25.0 }; +const TILEMAP_WIDTH: u32 = 50; +const TILEMAP_HEIGHT: u32 = 25; + +const TILE_WIDTH: f32 = 25.0; +const TILE_HEIGHT: f32 = 25.0; + +const MAP_SIZE: TilemapSize = TilemapSize { + x: TILEMAP_WIDTH, + y: TILEMAP_HEIGHT, +}; +const TILE_SIZE: TilemapTileSize = TilemapTileSize { + x: TILE_WIDTH, + y: TILE_HEIGHT, +}; fn startup(mut commands: Commands, asset_server: Res) { commands.spawn(Camera2d); @@ -94,8 +106,11 @@ fn main() { .set(WindowPlugin { primary_window: Some(Window { title: String::from("War in Tunnels"), - resolution: WindowResolution::new(1250, 625) - .with_scale_factor_override(1.0), + resolution: WindowResolution::new( + TILEMAP_WIDTH * TILE_WIDTH as u32, + TILEMAP_HEIGHT * TILE_HEIGHT as u32, + ) + .with_scale_factor_override(1.0), ..Default::default() }), ..default()