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    /// Optional same-device GPU texture composite target submitted without CPU pixel readback.
12    pub(crate) gpu_composite: Option<GpuCompositeDescriptor>,
13}
14
15/// Shared host coordinating a `GameScene`, fixed-timestep `FrameClock`, and `InputState` inside `euv`.
16#[derive(Clone, CustomDebug, Data)]
17pub struct GameEngineHost {
18    /// Fixed-timestep simulation clock.
19    pub(crate) clock: Rc<RefCell<FrameClock>>,
20    /// Real-time polled input state.
21    pub(crate) input: Rc<RefCell<InputState>>,
22    /// Hosted game scene implementation.
23    #[debug(skip)]
24    #[get(skip)]
25    pub(crate) scene: Rc<RefCell<dyn GameScene>>,
26    /// Mounted viewport canvas `(scene, node)` handles used to gate stepping and auto-dirty visible viewports.
27    #[debug(skip)]
28    pub(crate) viewport_nodes: Rc<RefCell<Vec<(SceneHandle, NodeId)>>>,
29    /// Latest same-device GPU composite descriptor captured during `mount_viewport` rendering for zero-readback compositing.
30    #[debug(skip)]
31    #[get(pub(crate))]
32    #[get_mut(skip)]
33    #[set(skip)]
34    pub(crate) last_gpu_composite: Rc<RefCell<Option<GpuCompositeDescriptor>>>,
35    /// Lifecycle pause flag set when the owning route or component is frozen (`PageRetention::Freeze`).
36    #[debug(skip)]
37    #[get_mut(skip)]
38    #[set(skip)]
39    pub(crate) paused: Rc<Cell<bool>>,
40}