Icons now work way better and don't have the the 'Rayview cuts icons' bug. It actually was a bug in the lel-guecs Sprite class that was using the TextureRect from the source sprite. Now its initialized with the framesize from the .json. This also uses the new guecs::Icon, but I have to fix that as it doesn't scale correctly. Closes #2.

This commit is contained in:
Zed A. Shaw 2025-07-22 15:03:37 -04:00
parent b311713064
commit ff7111b006
22 changed files with 81 additions and 64 deletions

View file

@ -80,7 +80,7 @@ namespace gui {
auto gui_id = $gui.entity(slot);
auto& sprite = $level.world->get<components::Sprite>(world_entity);
$gui.set_init<guecs::Sprite>(gui_id, {fmt::format("{}_ICON", sprite.name)});
$gui.set_init<guecs::Icon>(gui_id, {sprite.name});
guecs::GrabSource grabber{ world_entity,
[&, gui_id]() { return remove_slot(gui_id); }};
grabber.setSprite($gui, gui_id);
@ -136,7 +136,7 @@ namespace gui {
inventory.remove(world_entity);
$gui.remove<guecs::GrabSource>(slot_id);
$gui.remove<guecs::Sprite>(slot_id);
$gui.remove<guecs::Icon>(slot_id);
}
void StatusUI::swap(guecs::Entity gui_a, guecs::Entity gui_b) {