Skip to content

Commit 0c500ef

Browse files
committed
gui/entity: Improved entity viewer label
1 parent ab74419 commit 0c500ef

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

eurochef/gui/src/entities.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use crate::{
2828
pub struct EntityListPanel {
2929
gl: Arc<glow::Context>,
3030
entity_renderer: Option<EntityFrame>,
31+
entity_label: String,
3132

3233
entity_previews: FnvHashMap<u32, Option<egui::TextureHandle>>,
3334

@@ -95,6 +96,7 @@ impl EntityListPanel {
9596
textures: Self::load_textures(&gl, textures),
9697
gl,
9798
entity_renderer: None,
99+
entity_label: String::new(),
98100
entities,
99101
skins,
100102
ref_entities,
@@ -139,10 +141,7 @@ impl EntityListPanel {
139141
self.entity_renderer = None;
140142
return;
141143
}
142-
ui.heading(format!(
143-
"{:x}",
144-
self.entity_renderer.as_ref().unwrap().hashcode
145-
));
144+
ui.heading(&self.entity_label);
146145
});
147146
}
148147

@@ -247,6 +246,13 @@ impl EntityListPanel {
247246
.on_hover_cursor(egui::CursorIcon::PointingHand)
248247
.clicked()
249248
{
249+
self.entity_label = match ty {
250+
0 => format!("Entity {:x}", i),
251+
1 => format!("Ref Entity {}", i),
252+
2 => format!("Animation Skin {:x}", i),
253+
_ => unreachable!(),
254+
};
255+
250256
if ty != 2 {
251257
self.entity_renderer = Some(EntityFrame::new(
252258
&self.gl,

0 commit comments

Comments
 (0)