You can now set a sprite as a background in Background which will simplify a lot of games that just place sprites over a single image.

This commit is contained in:
Zed A. Shaw 2025-06-01 22:52:54 -04:00
parent 6fb20c5085
commit e1d61dc2c1
9 changed files with 79 additions and 22 deletions

View file

@ -104,6 +104,7 @@ namespace guecs {
float h = 0.0f;
sf::Color color=THEME.BG_COLOR;
shared_ptr<sf::RectangleShape> shape = nullptr;
shared_ptr<sf::Sprite> sprite = nullptr;
Background(lel::Parser& parser, sf::Color bg_color=THEME.BG_COLOR) :
x(parser.grid_x),
@ -117,5 +118,8 @@ namespace guecs {
void init();
void render(sf::RenderWindow& window);
void set_color(sf::Color c);
void set_sprite(const std::string& name, bool stretch=false);
};
}