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
56
57
58
59
60
61
62
63
64
65
use raylib::prelude::*;
use crate::{
discord::DiscordChannel, global_resource_package::GlobalResources,
project_constants::ProjectConstants,
};
use self::{player_interaction::PlayableScene, test_fox::TestFoxScene};
mod player_interaction;
mod test_fox;
pub struct SceneRenderDelegate {
scene_test_fox: TestFoxScene,
scene_playable: PlayableScene,
}
impl SceneRenderDelegate {
pub fn on_game_start(
raylib: &mut RaylibHandle,
rl_thread: &RaylibThread,
constants: &ProjectConstants,
) -> Self {
let scene_test_fox = TestFoxScene::new(raylib, rl_thread);
let scene_playable = PlayableScene::new(raylib, rl_thread, constants);
Self {
scene_test_fox,
scene_playable,
}
}
pub async fn process_ingame_frame(
&mut self,
raylib: &mut RaylibHandle,
rl_thread: &RaylibThread,
discord: &DiscordChannel,
global_resources: &GlobalResources,
constants: &ProjectConstants,
) {
self.scene_playable
.render_frame(raylib, rl_thread, &discord, global_resources, constants)
.await;
}
}
impl Drop for SceneRenderDelegate {
fn drop(&mut self) {}
}