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

@ -15,12 +15,15 @@ namespace textures {
sf::Vector2i frame_size;
};
using SpriteTextureMap = std::unordered_map<std::string, SpriteTexture>;
struct TextureManager {
std::vector<sf::Image> surfaces;
std::vector<size_t> ceilings;
std::vector<wchar_t> map_tile_set;
std::vector<int> ambient_light;
std::unordered_map<std::string, SpriteTexture> sprite_textures;
SpriteTextureMap sprite_textures;
SpriteTextureMap icon_textures;
std::unordered_map<std::string, size_t> name_to_id;
std::unordered_map<wchar_t, sf::Sprite> map_sprites;
sf::Texture map_sprite_sheet{"./assets/map_tiles.png"};
@ -28,7 +31,8 @@ namespace textures {
void init();
SpriteTexture get(const std::string& name);
SpriteTexture get_sprite(const std::string& name);
SpriteTexture get_icon(const std::string& name);
sf::Image load_image(const std::string& filename);