summaryrefslogtreecommitdiff
path: root/src/renderer/dummy.rs
blob: 6a5b37855f0808d319ce76934870d10a9d535a44 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use winit::application::ApplicationHandler;

use super::backend::RendererBackend;
use super::text::TextSpan;

#[derive(Debug, Clone)]
pub struct DummyRenderer;

impl DummyRenderer {
    pub fn new() -> Self {
        Self
    }
}

impl RendererBackend for DummyRenderer {
    fn init(&mut self, _width: i32, _height: i32) -> bool {
        println!("DummyRenderer initialized.");
        true
    }

    fn draw_text(&mut self, span: &TextSpan) {
        println!("[style: {:?}] {}", span.style, span.text);
    }

    fn shutdown(&mut self) {
        println!("DummyRenderer shutting down.");
    }

    fn name(&self) -> &str {
        "Dummy"
    }

    fn clear(&mut self) {
        println!("DummyRenderer clearing.");
    }

    fn present(&mut self) {
        println!("DummyRenderer is presenting.");
    }
}

impl ApplicationHandler for DummyRenderer {
    fn resumed(&mut self, event_loop: &winit::event_loop::ActiveEventLoop) {
        println!("resumed");
    }

    fn window_event(
        &mut self,
        event_loop: &winit::event_loop::ActiveEventLoop,
        window_id: winit::window::WindowId,
        event: winit::event::WindowEvent,
    ) {
        println!("received an event: {event:?}");
    }
}