equal
deleted
inserted
replaced
11 outline_template_based::template_based::TemplatedLandGenerator, LandGenerationParameters, |
11 outline_template_based::template_based::TemplatedLandGenerator, LandGenerationParameters, |
12 LandGenerator, |
12 LandGenerator, |
13 }; |
13 }; |
14 use lfprng::LaggedFibonacciPRNG; |
14 use lfprng::LaggedFibonacciPRNG; |
15 use std::path::{Path, PathBuf}; |
15 use std::path::{Path, PathBuf}; |
|
16 use log::trace; |
16 |
17 |
17 use crate::render::{camera::Camera, GearEntry, GearRenderer, MapRenderer}; |
18 use crate::render::{camera::Camera, GearEntry, GearRenderer, MapRenderer}; |
18 |
19 |
19 struct GameState { |
20 struct GameState { |
20 land: Land2D<u32>, |
21 land: Land2D<u32>, |
58 let land_tile_size = Size::square(512); |
59 let land_tile_size = Size::square(512); |
59 self.map_renderer = Some(MapRenderer::new(land_tile_size)); |
60 self.map_renderer = Some(MapRenderer::new(land_tile_size)); |
60 self.gear_renderer = Some(GearRenderer::new(&self.data_path.as_path())); |
61 self.gear_renderer = Some(GearRenderer::new(&self.data_path.as_path())); |
61 self.camera = Camera::with_size(Size::new(width as usize, height as usize)); |
62 self.camera = Camera::with_size(Size::new(width as usize, height as usize)); |
62 |
63 |
|
64 if let Some(ref state) = self.game_state { |
|
65 self.camera.position = state.land.play_box().center(); |
|
66 } |
|
67 } |
|
68 |
|
69 pub fn init_renderer(&mut self) { |
63 use mapgen::{theme::Theme, MapGenerator}; |
70 use mapgen::{theme::Theme, MapGenerator}; |
64 |
71 |
65 if let Some(ref state) = self.game_state { |
72 if let Some(ref state) = self.game_state { |
66 self.camera.position = state.land.play_box().center(); |
73 self.camera.position = state.land.play_box().center(); |
67 |
74 |