mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-14 11:45:01 +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::{
|
||||
cmdline::CmdLine, command::CmdVec, game::GameState,
|
||||
math::{px_per_frame_to_km_h, WorldPos},
|
||||
res::Res, stringfmt::LengthDisp, texture_atlas::AtlasBundle,
|
||||
command::CmdVec, game::GameState, res::Res, texture_atlas::AtlasBundle,
|
||||
tiles::tiledb_edit_ui::TileDbEdit,
|
||||
};
|
||||
use egui_inspect::{derive::Inspect, inspect};
|
||||
use sfml::audio::SoundSource;
|
||||
#[derive(Default, Debug, Inspect)]
|
||||
pub(crate) struct DebugState {
|
||||
pub(crate) panel: bool,
|
||||
|
|
@ -27,48 +23,33 @@ fn debug_panel_ui(
|
|||
res: &mut Res,
|
||||
mut scale: &mut u8,
|
||||
) {
|
||||
egui::Window::new("Debug (F12)")
|
||||
.show(
|
||||
ctx,
|
||||
|ui| {
|
||||
|
||||
ui.label("Music volume");
|
||||
let mut vol = res.surf_music.volume();
|
||||
ui.add(egui::DragValue::new(&mut vol));
|
||||
res.surf_music.set_volume(vol);
|
||||
ui.separator();
|
||||
egui::ScrollArea::both()
|
||||
.id_source("insp_scroll")
|
||||
.max_height(240.)
|
||||
.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);
|
||||
egui::Window::new("Debug (F12)").show(ctx, |ui| {
|
||||
ui.label("Music volume");
|
||||
let mut vol = res.surf_music.volume();
|
||||
ui.add(egui::DragValue::new(&mut vol));
|
||||
res.surf_music.set_volume(vol);
|
||||
ui.separator();
|
||||
egui::ScrollArea::both()
|
||||
.id_source("insp_scroll")
|
||||
.max_height(240.)
|
||||
.max_width(340.0)
|
||||
.show(ui, |ui| {
|
||||
inspect! {
|
||||
ui, scale, game, debug
|
||||
}
|
||||
ui.separator();
|
||||
egui::ScrollArea::vertical()
|
||||
.show(
|
||||
ui,
|
||||
|ui| {
|
||||
gamedebug_core::for_each_imm(|info| match info {
|
||||
gamedebug_core::Info::Msg(msg) => {
|
||||
ui.label(msg);
|
||||
}
|
||||
gamedebug_core::Info::Rect(_, _, _, _, _) => todo!(),
|
||||
});
|
||||
},
|
||||
);
|
||||
gamedebug_core::clear_immediates();
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
ui.separator();
|
||||
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||
gamedebug_core::for_each_imm(|info| match info {
|
||||
gamedebug_core::Info::Msg(msg) => {
|
||||
ui.label(msg);
|
||||
}
|
||||
gamedebug_core::Info::Rect(_, _, _, _, _) => todo!(),
|
||||
});
|
||||
});
|
||||
gamedebug_core::clear_immediates();
|
||||
});
|
||||
}
|
||||
pub(crate) fn do_debug_ui(
|
||||
ctx: &egui::Context,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue