project-kyoku/modes/classicmode/graphics/classicspritefactory.h

40 lines
873 B
C++

#pragma once
#include <memory>
#include "classicmode/classicactions.h"
#include "classicsprite.h"
class ClassicSpriteFactory
{
public:
inline std::shared_ptr<ClassicSprite> create(Type type)
{
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<ClassicSprite>(sprite);
}
};