aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-test-support/src/lib.rs
blob: cb4f55255545f9b4c95ef837d4e84f6407d3ec7e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#![forbid(unsafe_code)]
//! Dev-only synthetic builders and fake ports.

use fparkan_render::{FrameOutput, RenderBackend, RenderCommandList, RenderError};

/// Fake clock.
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct FakeClock {
    /// Current tick.
    pub tick: u64,
}

/// Recording backend.
#[derive(Clone, Debug, Default)]
pub struct RecordingRenderBackend {
    /// Recorded command lists.
    pub captures: Vec<RenderCommandList>,
}

impl RenderBackend for RecordingRenderBackend {
    fn execute(&mut self, commands: &RenderCommandList) -> Result<FrameOutput, RenderError> {
        self.captures.push(commands.clone());
        Ok(FrameOutput)
    }
}