micro_games_kit/
context.rs

1use crate::{audio::Audio, game::GameStateChange};
2use keket::database::AssetDatabase;
3use spitfire_draw::{context::DrawContext, utils::Vertex};
4use spitfire_glow::graphics::Graphics;
5use spitfire_gui::context::GuiContext;
6use spitfire_input::InputContext;
7
8pub struct GameContext<'a> {
9    pub graphics: &'a mut Graphics<Vertex>,
10    pub draw: &'a mut DrawContext,
11    pub gui: &'a mut GuiContext,
12    pub input: &'a mut InputContext,
13    pub state_change: &'a mut GameStateChange,
14    pub assets: &'a mut AssetDatabase,
15    pub audio: &'a mut Audio,
16}
17
18impl<'a> GameContext<'a> {
19    pub fn fork(&'a mut self) -> Self {
20        Self {
21            graphics: self.graphics,
22            draw: self.draw,
23            gui: self.gui,
24            input: self.input,
25            state_change: self.state_change,
26            assets: self.assets,
27            audio: self.audio,
28        }
29    }
30}