diff --git a/src/game.rs b/src/game.rs index f637fff..19a8f63 100644 --- a/src/game.rs +++ b/src/game.rs @@ -43,7 +43,7 @@ fn for_each_tile_on_screen(camera_offset: WorldPos, mut f: impl FnMut(TilePos, S impl Default for GameState { fn default() -> Self { Self { - camera_offset: WorldPos { x: 0, y: 0 }, + camera_offset: WorldPos::SURFACE_CENTER, world: Default::default(), } } diff --git a/src/math.rs b/src/math.rs index 6f14441..cc7b68b 100644 --- a/src/math.rs +++ b/src/math.rs @@ -17,6 +17,14 @@ impl WorldPos { y: wp_to_tp(self.y), } } + /// Horizontal center of the world + pub const CENTER: WorldPosScalar = WorldPosScalar::MAX / 2; + /// Vertical surface level + pub const SURFACE: WorldPosScalar = WorldPosScalar::MAX / 3; + pub const SURFACE_CENTER: Self = Self { + x: Self::CENTER, + y: Self::SURFACE, + }; } pub fn wp_to_tp(wp: WorldPosScalar) -> TilePosScalar {