mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 20:35:02 +01:00
Add arg parsing, support multiple worlds
This commit is contained in:
parent
83f35e51ee
commit
129585ba64
5 changed files with 140 additions and 22 deletions
36
src/game.rs
36
src/game.rs
|
|
@ -113,6 +113,23 @@ impl GameState {
|
|||
lightmap.draw(&s);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn new(world_name: String) -> GameState {
|
||||
let mut spawn_point = WorldPos::SURFACE_CENTER;
|
||||
spawn_point.y -= 1104;
|
||||
Self {
|
||||
camera_offset: spawn_point,
|
||||
world: World::new(spawn_point, &world_name),
|
||||
gravity: 0.55,
|
||||
tile_to_place: 1,
|
||||
current_biome: Biome::Surface,
|
||||
prev_biome: Biome::Surface,
|
||||
worldgen: Worldgen::default(),
|
||||
ambient_light: 0,
|
||||
light_sources: Vec::new(),
|
||||
tile_db: TileDb::load_or_default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn for_each_tile_on_screen(
|
||||
|
|
@ -135,22 +152,3 @@ pub fn for_each_tile_on_screen(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for GameState {
|
||||
fn default() -> Self {
|
||||
let mut spawn_point = WorldPos::SURFACE_CENTER;
|
||||
spawn_point.y -= 1104;
|
||||
Self {
|
||||
camera_offset: spawn_point,
|
||||
world: World::new(spawn_point, "TestWorld"),
|
||||
gravity: 0.55,
|
||||
tile_to_place: 1,
|
||||
current_biome: Biome::Surface,
|
||||
prev_biome: Biome::Surface,
|
||||
worldgen: Worldgen::default(),
|
||||
ambient_light: 0,
|
||||
light_sources: Vec::new(),
|
||||
tile_db: TileDb::load_or_default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue