diff --git a/modules/graphics/antara/gaming/graphics/component.sprite.hpp b/modules/graphics/antara/gaming/graphics/component.sprite.hpp index ae528eae..2912b5cd 100644 --- a/modules/graphics/antara/gaming/graphics/component.sprite.hpp +++ b/modules/graphics/antara/gaming/graphics/component.sprite.hpp @@ -16,6 +16,7 @@ #pragma once +#include //! std::string #include "antara/gaming/transform/component.properties.hpp" #include "antara/gaming/transform/component.position.hpp" #include "antara/gaming/core/safe.refl.hpp" @@ -31,7 +32,7 @@ namespace antara::gaming::graphics struct sprite { - const char *appearance; //! texture id + std::string appearance; //! texture id bool native_size{true}; //! take the whole size by default rect texture_rec{}; //! Set the sub-rectangle of the texture that the sprite will display if native_size is false }; diff --git a/modules/sfml/antara/gaming/sfml/graphic.system.cpp b/modules/sfml/antara/gaming/sfml/graphic.system.cpp index bcd33799..07dbc8eb 100644 --- a/modules/sfml/antara/gaming/sfml/graphic.system.cpp +++ b/modules/sfml/antara/gaming/sfml/graphic.system.cpp @@ -312,8 +312,8 @@ namespace antara::gaming::sfml graphic_system::on_sprite_construct(entt::entity entity, entt::registry ®istry, graphics::sprite &spr) noexcept { auto &resources_system = this->entity_registry_.ctx(); - auto handle = resources_system.load_texture(spr.appearance); - sf::Sprite &native_sprite = registry.assign(entity, sf::Sprite(handle.get())).drawable; + auto handle = resources_system.load_texture(spr.appearance.c_str()); + sf::Sprite &native_sprite = registry.assign_or_replace(entity, sf::Sprite(handle.get())).drawable; if (not spr.native_size) { auto[left, top] = spr.texture_rec.pos;