forked from NaiJi/project-kyoku
40 lines
861 B
C++
40 lines
861 B
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include "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);
|
|
}
|
|
};
|
|
|