rust/lib-hedgewars-engine/src/world.rs
branchtransitional_engine
changeset 16051 2003b466b279
parent 15954 9502611bffc1
parent 16046 e8afb1bf2779
--- a/rust/lib-hedgewars-engine/src/world.rs	Wed Aug 28 15:31:51 2024 +0200
+++ b/rust/lib-hedgewars-engine/src/world.rs	Wed Aug 28 15:34:49 2024 +0200
@@ -13,6 +13,7 @@
 };
 use lfprng::LaggedFibonacciPRNG;
 use std::path::{Path, PathBuf};
+use log::trace;
 
 use crate::render::{camera::Camera, GearEntry, GearRenderer, MapRenderer};
 
@@ -60,6 +61,12 @@
         self.gear_renderer = Some(GearRenderer::new(&self.data_path.as_path()));
         self.camera = Camera::with_size(Size::new(width as usize, height as usize));
 
+        if let Some(ref state) = self.game_state {
+            self.camera.position = state.land.play_box().center();
+        }
+    }
+
+    pub fn init_renderer(&mut self) {
         use mapgen::{theme::Theme, MapGenerator};
 
         if let Some(ref state) = self.game_state {