#include "spritefactorysfml.h" ClassicSpriteFactorySFML::ClassicSpriteFactorySFML(const std::shared_ptr& render_target) : _render_target(render_target) {} std::shared_ptr ClassicSpriteFactorySFML::create(Type type) const { sf::RectangleShape sprite; sprite.setSize({20.f, 20.f}); switch (type) { case Type::UP: sprite.setFillColor(sf::Color(255, 0, 0)); break; case Type::DOWN: sprite.setFillColor(sf::Color(0, 255, 0)); break; case Type::LEFT: sprite.setFillColor(sf::Color(0, 0, 255)); break; case Type::RIGHT: sprite.setFillColor(sf::Color(255, 0, 255)); break; default: // yellow sprite.setFillColor(sf::Color(255, 239, 0)); } return std::make_shared(_render_target, sprite); }