mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-14 19:55:02 +01:00
Define world center
This commit is contained in:
parent
f69d05bed0
commit
2480c48cbf
2 changed files with 9 additions and 1 deletions
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue