From 766e5935a114bda26274ecd2c018a8fbc836b481 Mon Sep 17 00:00:00 2001 From: nils <48135649+Nilstrieb@users.noreply.github.com> Date: Tue, 18 Apr 2023 12:25:54 +0200 Subject: [PATCH] more --- src/tiles.rs | 25 ++++++++++++++++++++++++- tiles.rs | 25 ++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/tiles.rs b/src/tiles.rs index 73c34a4..653be76 100644 --- a/src/tiles.rs +++ b/src/tiles.rs @@ -2,12 +2,35 @@ use std::{fmt::Debug, marker::PhantomData}; use egui_inspect::{derive::Inspect, Inspect}; -#[derive(Inspect)] pub struct TileDef { pub layer: (), //ADD pub blend_graphic: String, } +impl ::egui_inspect::Inspect for TileDef { + fn inspect(&self, ui: &mut ::egui::Ui, id_source: u64) {} + fn inspect_mut(&mut self, ui: &mut ::egui::Ui, id_source: u64) { + ::egui::CollapsingHeader::new("TileDef") + .id_source(id_source) + .show(ui, |ui| { + ui.horizontal(|ui| { + if ui + .add(::egui::Label::new("pub layer : ()").sense(::egui::Sense::click())) + .clicked() + { + ui.output_mut(|o| { + o.copied_text = { + let res = ::std::fmt::format(format_args!("{0:?}", self.layer)); + res + }; + }); + } + ::egui_inspect::Inspect::inspect_mut(&mut self.layer, ui, 0usize as u64) + }); + }); + } +} + impl Debug for TileDef { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { loop {} diff --git a/tiles.rs b/tiles.rs index 73c34a4..653be76 100644 --- a/tiles.rs +++ b/tiles.rs @@ -2,12 +2,35 @@ use std::{fmt::Debug, marker::PhantomData}; use egui_inspect::{derive::Inspect, Inspect}; -#[derive(Inspect)] pub struct TileDef { pub layer: (), //ADD pub blend_graphic: String, } +impl ::egui_inspect::Inspect for TileDef { + fn inspect(&self, ui: &mut ::egui::Ui, id_source: u64) {} + fn inspect_mut(&mut self, ui: &mut ::egui::Ui, id_source: u64) { + ::egui::CollapsingHeader::new("TileDef") + .id_source(id_source) + .show(ui, |ui| { + ui.horizontal(|ui| { + if ui + .add(::egui::Label::new("pub layer : ()").sense(::egui::Sense::click())) + .clicked() + { + ui.output_mut(|o| { + o.copied_text = { + let res = ::std::fmt::format(format_args!("{0:?}", self.layer)); + res + }; + }); + } + ::egui_inspect::Inspect::inspect_mut(&mut self.layer, ui, 0usize as u64) + }); + }); + } +} + impl Debug for TileDef { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { loop {}