Fix up the backend so it has sane names like get_sprite and get_icon, then implemented a guecs::Icon for icons. Those don't scale and typically have other properties different from a Sprite.

This commit is contained in:
Zed A. Shaw 2025-07-22 12:59:10 -04:00
parent 31a02505aa
commit 5a7c096b52
9 changed files with 76 additions and 29 deletions

View file

@ -35,17 +35,20 @@ namespace guecs {
struct SpriteTexture {
std::shared_ptr<sf::Sprite> sprite = nullptr;
std::shared_ptr<sf::Texture> texture = nullptr;
sf::Vector2i frame_size;
};
class Backend {
public:
virtual SpriteTexture texture_get(const string& name) = 0;
virtual SpriteTexture get_sprite(const string& name) = 0;
virtual SpriteTexture get_icon(const string& name) = 0;
virtual void sound_play(const string& name) = 0;
virtual void sound_stop(const string& name) = 0;
virtual std::shared_ptr<sf::Shader> shader_get(const std::string& name) = 0;
virtual std::shared_ptr<sf::Shader> get_shader(const std::string& name) = 0;
virtual bool shader_updated() = 0;
virtual Theme theme() = 0;