Skip to main content

euv_core/game/viewport/
struct.rs

1use super::*;
2
3/// Viewport-local immediate-mode 2D/framebuffer drawing surface passed to `GameScene::render`.
4#[derive(CustomDebug)]
5pub struct GameRenderContext<'a> {
6    /// Viewport bounds in root logical coordinates.
7    pub(crate) bounds: Rect,
8    /// Active display list receiving hardware/software/hybrid draw commands.
9    #[debug(skip)]
10    pub(crate) display_list: &'a mut DisplayList,
11}
12
13/// Shared host coordinating a `GameScene`, fixed-timestep `FrameClock`, and `InputState` inside `euv`.
14#[derive(Clone, CustomDebug, Data)]
15pub struct GameEngineHost {
16    /// Fixed-timestep simulation clock.
17    pub(crate) clock: Rc<RefCell<FrameClock>>,
18    /// Real-time polled input state.
19    pub(crate) input: Rc<RefCell<InputState>>,
20    /// Hosted game scene implementation.
21    #[debug(skip)]
22    #[get(skip)]
23    pub(crate) scene: Rc<RefCell<dyn GameScene>>,
24    /// Mounted viewport canvas `(scene, node)` handles used to gate stepping and auto-dirty visible viewports.
25    #[debug(skip)]
26    pub(crate) viewport_nodes: Rc<RefCell<Vec<(SceneHandle, NodeId)>>>,
27    /// Lifecycle pause flag set when the owning route or component is frozen (`PageRetention::Freeze`).
28    #[debug(skip)]
29    #[get_mut(skip)]
30    #[set(skip)]
31    pub(crate) paused: Rc<Cell<bool>>,
32}