1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::{
    render::{view_state::ViewState, Renderer},
    style::Style,
    tcs::world::World,
    window::PhysicalSize,
};

/// Stores the context of the map.
///
/// This struct should not depend on the [`crate::environment::Environment`] trait. Else types
/// throughout the crate get messy quickly.
pub struct MapContext {
    pub style: Style,
    pub world: World,
    pub view_state: ViewState,
    pub renderer: Renderer,
}

impl MapContext {
    pub fn resize(&mut self, size: PhysicalSize, scale_factor: f64) {
        self.view_state.resize(size.to_logical(scale_factor));
        self.renderer.resize_surface(size)
    }
}