-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use yakui::{ | ||
align, colored_box, colored_box_container, label, pad, widgets::Pad, Alignment, Color, | ||
}; | ||
|
||
use crate::Sim; | ||
|
||
pub struct GuiState { | ||
show_gui: bool, | ||
} | ||
|
||
impl GuiState { | ||
pub fn new() -> Self { | ||
GuiState { show_gui: true } | ||
} | ||
|
||
pub fn toggle_gui(&mut self) { | ||
self.show_gui = !self.show_gui; | ||
} | ||
} | ||
|
||
pub fn gui(gui_state: &GuiState, sim: &Sim) { | ||
if !gui_state.show_gui { | ||
return; | ||
} | ||
|
||
align(Alignment::CENTER, || { | ||
colored_box(Color::BLACK.with_alpha(0.9), [5.0, 5.0]); | ||
}); | ||
|
||
align(Alignment::TOP_LEFT, || { | ||
pad(Pad::all(8.0), || { | ||
colored_box_container(Color::BLACK.with_alpha(0.7), || { | ||
label(format!("Selected material: {:?}", sim.selected_material())); | ||
}); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ mod draw; | |
mod fog; | ||
mod frustum; | ||
mod gltf_mesh; | ||
mod gui; | ||
mod meshes; | ||
mod png_array; | ||
pub mod voxels; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters