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
use super::*;
pub trait GameMut {
fn step(&mut self, arguments: &StepArguments);
fn draw(&mut self, arguments: &DrawArguments) -> Image;
fn render_audio(&mut self, arguments: &RenderAudioArguments) -> Sound;
}
pub struct GameMutMap {
game: Box<Game>,
}
impl GameMutMap {
pub fn new(game: Box<Game>) -> Self {
Self { game }
}
}
impl GameMut for GameMutMap {
fn step(&mut self, arguments: &StepArguments) {
self.game.step(arguments)
}
fn draw(&mut self, arguments: &DrawArguments) -> Image {
self.game.draw(arguments)
}
fn render_audio(&mut self, arguments: &RenderAudioArguments) -> Sound {
self.game.render_audio(arguments)
}
}
pub struct RunBundle {
pub game: Box<GameMut>,
pub info: Info,
}
impl RunBundle {
pub fn new(game: Box<GameMut>, info: Info) -> Self {
Self { game, info }
}
}