Skip to content

Commit

Permalink
Dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
makscee committed May 1, 2024
1 parent 9ed0a77 commit 65c23c2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/plugins/main_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ impl MainMenuPlugin {
GameState::change(GameState::HeroGallery, world);
}
});
if cfg!(debug_assertions) {
if SettingsData::get(world).dev_mode {
frame(ui, |ui| {
if ui.button("CLIPBOARD BATTLE").clicked() {
GameState::change(GameState::ClipboardBattle, world);
}
});
frame(ui, |ui| {
ui.columns(3, |ui| {
ui[0].vertical_centered_justified(|ui| {
Expand Down
22 changes: 21 additions & 1 deletion src/plugins/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub struct SettingsData {
pub master_volume: f64,
pub expanded_hint: bool,
pub always_show_card: bool,
pub dev_mode: bool,
pub window_mode: WindowMode,
pub resolution: Vec2,
pub vsync: VsyncMode,
Expand Down Expand Up @@ -41,6 +42,7 @@ impl Default for SettingsData {
resolution: vec2(1280.0, 720.0),
window_mode: default(),
always_show_card: default(),
dev_mode: default(),
vsync: default(),
}
}
Expand Down Expand Up @@ -158,6 +160,24 @@ impl SettingsPlugin {
});
})
});

frame(ui, |ui| {
ui.columns(2, |ui| {
"dev mode".to_colored().label(&mut ui[0]);
ui[1].vertical_centered_justified(|ui| {
let value = &mut data.dev_mode;
if ui
.button_or_primary(
if *value { "ENABLED" } else { "DISABLED" },
*value,
)
.clicked()
{
*value = !*value;
}
});
});
});
frame(ui, |ui| {
if ui.button_red("RESET TO DEFAULTS").clicked() {
data = default();
Expand All @@ -166,7 +186,7 @@ impl SettingsPlugin {
frame(ui, |ui| {
if ui
.button_red("CLEAR DATA")
.on_hover_text("Clear saved game and other data")
.on_hover_text("Clear any persistent data")
.clicked()
{
PersistentData::default().save(world).unwrap();
Expand Down

0 comments on commit 65c23c2

Please sign in to comment.