mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-17 04:45:02 +01:00
more
This commit is contained in:
parent
f35bdb13e2
commit
7f42110046
1 changed files with 29 additions and 48 deletions
77
src/debug.rs
77
src/debug.rs
|
|
@ -1,13 +1,9 @@
|
||||||
use std::fmt::Write;
|
|
||||||
use egui::TextBuffer;
|
|
||||||
use egui_inspect::{derive::Inspect, inspect};
|
|
||||||
use sfml::audio::SoundSource;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
cmdline::CmdLine, command::CmdVec, game::GameState,
|
command::CmdVec, game::GameState, res::Res, texture_atlas::AtlasBundle,
|
||||||
math::{px_per_frame_to_km_h, WorldPos},
|
|
||||||
res::Res, stringfmt::LengthDisp, texture_atlas::AtlasBundle,
|
|
||||||
tiles::tiledb_edit_ui::TileDbEdit,
|
tiles::tiledb_edit_ui::TileDbEdit,
|
||||||
};
|
};
|
||||||
|
use egui_inspect::{derive::Inspect, inspect};
|
||||||
|
use sfml::audio::SoundSource;
|
||||||
#[derive(Default, Debug, Inspect)]
|
#[derive(Default, Debug, Inspect)]
|
||||||
pub(crate) struct DebugState {
|
pub(crate) struct DebugState {
|
||||||
pub(crate) panel: bool,
|
pub(crate) panel: bool,
|
||||||
|
|
@ -27,48 +23,33 @@ fn debug_panel_ui(
|
||||||
res: &mut Res,
|
res: &mut Res,
|
||||||
mut scale: &mut u8,
|
mut scale: &mut u8,
|
||||||
) {
|
) {
|
||||||
egui::Window::new("Debug (F12)")
|
egui::Window::new("Debug (F12)").show(ctx, |ui| {
|
||||||
.show(
|
ui.label("Music volume");
|
||||||
ctx,
|
let mut vol = res.surf_music.volume();
|
||||||
|ui| {
|
ui.add(egui::DragValue::new(&mut vol));
|
||||||
|
res.surf_music.set_volume(vol);
|
||||||
ui.label("Music volume");
|
ui.separator();
|
||||||
let mut vol = res.surf_music.volume();
|
egui::ScrollArea::both()
|
||||||
ui.add(egui::DragValue::new(&mut vol));
|
.id_source("insp_scroll")
|
||||||
res.surf_music.set_volume(vol);
|
.max_height(240.)
|
||||||
ui.separator();
|
.max_width(340.0)
|
||||||
egui::ScrollArea::both()
|
.show(ui, |ui| {
|
||||||
.id_source("insp_scroll")
|
inspect! {
|
||||||
.max_height(240.)
|
ui, scale, game, debug
|
||||||
.max_width(340.0)
|
|
||||||
.show(
|
|
||||||
ui,
|
|
||||||
|ui| {
|
|
||||||
inspect! {
|
|
||||||
ui, scale, game, debug
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
if ui.button("Reload graphics").clicked() {
|
|
||||||
res.atlas = AtlasBundle::new().unwrap();
|
|
||||||
game.tile_db.update_rects(&res.atlas.rects);
|
|
||||||
}
|
}
|
||||||
ui.separator();
|
});
|
||||||
egui::ScrollArea::vertical()
|
|
||||||
.show(
|
ui.separator();
|
||||||
ui,
|
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||||
|ui| {
|
gamedebug_core::for_each_imm(|info| match info {
|
||||||
gamedebug_core::for_each_imm(|info| match info {
|
gamedebug_core::Info::Msg(msg) => {
|
||||||
gamedebug_core::Info::Msg(msg) => {
|
ui.label(msg);
|
||||||
ui.label(msg);
|
}
|
||||||
}
|
gamedebug_core::Info::Rect(_, _, _, _, _) => todo!(),
|
||||||
gamedebug_core::Info::Rect(_, _, _, _, _) => todo!(),
|
});
|
||||||
});
|
});
|
||||||
},
|
gamedebug_core::clear_immediates();
|
||||||
);
|
});
|
||||||
gamedebug_core::clear_immediates();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
pub(crate) fn do_debug_ui(
|
pub(crate) fn do_debug_ui(
|
||||||
ctx: &egui::Context,
|
ctx: &egui::Context,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue