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

40 lines
873 B
C
Raw Normal View History

2021-06-16 19:11:00 +02:00
#pragma once
#include <memory>
#include "classicmode/classicactions.h"
2021-06-16 19:11:00 +02:00
#include "classicsprite.h"
class ClassicSpriteFactory
{
public:
inline std::shared_ptr<ClassicSprite> create(Type type)
2021-06-16 19:11:00 +02:00
{
sf::RectangleShape sprite;
sprite.setSize({20.f, 20.f});
switch (type)
2021-06-16 19:11:00 +02:00
{
case Type::UP:
2021-06-16 19:11:00 +02:00
sprite.setFillColor(sf::Color(255, 0, 0));
break;
case Type::DOWN:
2021-06-16 19:11:00 +02:00
sprite.setFillColor(sf::Color(0, 255, 0));
break;
case Type::LEFT:
2021-06-16 19:11:00 +02:00
sprite.setFillColor(sf::Color(0, 0, 255));
break;
case Type::RIGHT:
2021-06-16 19:11:00 +02:00
sprite.setFillColor(sf::Color(255, 0, 255));
break;
default: // yellow
sprite.setFillColor(sf::Color(255, 239, 0));
}
return std::make_shared<ClassicSprite>(sprite);
2021-06-16 19:11:00 +02:00
}
};