2021-06-16 19:11:00 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
2021-11-17 23:14:52 +01:00
|
|
|
#include "classicmode/classicactions.h"
|
2021-06-16 19:11:00 +02:00
|
|
|
#include "classicsprite.h"
|
|
|
|
|
|
|
|
class ClassicSpriteFactory
|
|
|
|
{
|
|
|
|
public:
|
2021-06-23 21:18:33 +02:00
|
|
|
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});
|
2021-06-23 21:18:33 +02:00
|
|
|
switch (type)
|
2021-06-16 19:11:00 +02:00
|
|
|
{
|
2021-06-23 21:18:33 +02:00
|
|
|
case Type::UP:
|
2021-06-16 19:11:00 +02:00
|
|
|
sprite.setFillColor(sf::Color(255, 0, 0));
|
|
|
|
break;
|
|
|
|
|
2021-06-23 21:18:33 +02:00
|
|
|
case Type::DOWN:
|
2021-06-16 19:11:00 +02:00
|
|
|
sprite.setFillColor(sf::Color(0, 255, 0));
|
|
|
|
break;
|
|
|
|
|
2021-06-23 21:18:33 +02:00
|
|
|
case Type::LEFT:
|
2021-06-16 19:11:00 +02:00
|
|
|
sprite.setFillColor(sf::Color(0, 0, 255));
|
|
|
|
break;
|
|
|
|
|
2021-06-23 21:18:33 +02:00
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
2021-10-04 16:20:24 +02:00
|
|
|
return std::make_shared<ClassicSprite>(sprite);
|
2021-06-16 19:11:00 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|