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
use std::ops::{Deref, DerefMut};

use bevy::{ecs::system::SystemParam, prelude::*};

use crate::text::TextProps;

#[derive(SystemParam)]
pub struct GuiCommands<'w, 's> {
    commands: Commands<'w, 's>,
    text_props: Res<'w, TextProps>,
}

impl<'w, 's> GuiCommands<'w, 's> {
    pub(crate) fn text_props(&self) -> &TextProps {
        self.text_props.as_ref()
    }
}

impl<'w, 's> Deref for GuiCommands<'w, 's> {
    type Target = Commands<'w, 's>;

    fn deref(&self) -> &Self::Target {
        &self.commands
    }
}

impl<'w, 's> DerefMut for GuiCommands<'w, 's> {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.commands
    }
}