fix camera inside houses
Some checks failed
Rust / rustfmt (push) Failing after 20s
Rust / clippy (push) Failing after 1m26s
Rust / build (push) Successful in 2m9s

This commit is contained in:
Dominic 2024-07-07 16:31:45 +02:00
parent 3816dbac77
commit b9e065058f
Signed by: msrd0
GPG key ID: AAF7C8430CA3345D

View file

@ -3,7 +3,7 @@ mod grid;
mod player; mod player;
mod room; mod room;
use comfy::{random_i32, EngineContext}; use comfy::{main_camera_mut, random_i32, vec2, EngineContext};
use grid::Grid; use grid::Grid;
use log::error; use log::error;
use player::Player; use player::Player;
@ -62,6 +62,9 @@ pub fn draw(state: &crate::State, _ctx: &comfy::EngineContext<'_>) {
} }
pub fn update(state: &mut crate::State, ctx: &mut comfy::EngineContext<'_>) { pub fn update(state: &mut crate::State, ctx: &mut comfy::EngineContext<'_>) {
let mut camera = main_camera_mut();
camera.center = vec2(0.0, 0.0);
let house = state.house_mut(ctx); let house = state.house_mut(ctx);
let current_room = house.rooms.get(house.current_room_id).unwrap(); let current_room = house.rooms.get(house.current_room_id).unwrap();
house.player.update(&current_room.grid); house.player.update(&current_room.grid);