Fixed Icon vs. Sprite and now Icon is just a subclass of Sprite. Closes #12.

This commit is contained in:
Zed A. Shaw 2025-07-22 17:11:02 -04:00
parent a22342cd7e
commit 3752522597
3 changed files with 26 additions and 5 deletions

View file

@ -40,7 +40,8 @@ namespace guecs {
struct Sprite {
string name;
int padding = THEME.PADDING;
bool stretch = false;
bool stretch = true;
bool is_icon = false;
std::shared_ptr<sf::Sprite> sprite = nullptr;
void init(lel::Cell &cell);
@ -48,7 +49,19 @@ namespace guecs {
void render(sf::RenderWindow& window, sf::Shader *shader_ptr);
};
struct Icon : public Sprite { };
struct Icon : public Sprite {
template<typename... Args>
Icon(Args... args) : Sprite(args...)
{
stretch = false;
is_icon = true;
}
Icon() {
// BUG: why do I have to do this again?
stretch = false;
};
};
struct Rectangle {
int padding = THEME.PADDING;