-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgui.rs
63 lines (48 loc) · 1.51 KB
/
gui.rs
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
#![allow(dead_code)]
use egui::Context;
use glium_app::Timer;
use crate::Client;
use self::pause_menu::PauseAction;
pub mod main_menu;
pub mod pause_menu;
pub mod fps_counter;
pub mod entities_window;
pub mod info_window;
pub mod options_window;
pub fn render(gui_ctx: &Context, cli: &mut Client, t: &Timer) {
match &mut cli.server {
Some(s) => {
if cli.settings.show_fps {
fps_counter::render(gui_ctx, t.fps(), t.delta());
}
if s.is_paused() {
entities_window::render(gui_ctx, &s);
info_window::render(gui_ctx, &s);
match pause_menu::render(gui_ctx, &mut cli.state) {
PauseAction::Unpause => {
s.set_paused(false, &mut cli.state);
},
PauseAction::Disconnect => {
s.disconnect();
cli.server = None;
}
_ => {}
}
}
},
None => {
match main_menu::render(gui_ctx, &mut cli.settings) {
Some(mut s) => {
s.set_paused(false, &mut cli.state);
cli.state.options_visible = false;
cli.server = Some(s);
},
None => {
}
}
}
}
if cli.state.options_visible {
options_window::render(gui_ctx, &mut cli.state, &mut cli.settings, &mut cli.rend);
}
}