2021-06-16 13:11:00 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
2021-11-17 17:14:52 -05:00
|
|
|
#include "classicmode/classicactions.h"
|
2021-06-16 13:11:00 -04:00
|
|
|
#include "classicsprite.h"
|
|
|
|
|
|
|
|
class ClassicSpriteFactory
|
|
|
|
{
|
|
|
|
public:
|
2021-06-23 15:18:33 -04:00
|
|
|
inline std::shared_ptr<ClassicSprite> create(Type type)
|
2021-06-16 13:11:00 -04:00
|
|
|
{
|
|
|
|
sf::RectangleShape sprite;
|
|
|
|
sprite.setSize({20.f, 20.f});
|
2021-06-23 15:18:33 -04:00
|
|
|
switch (type)
|
2021-06-16 13:11:00 -04:00
|
|
|
{
|
2021-06-23 15:18:33 -04:00
|
|
|
case Type::UP:
|
2021-06-16 13:11:00 -04:00
|
|
|
sprite.setFillColor(sf::Color(255, 0, 0));
|
|
|
|
break;
|
|
|
|
|
2021-06-23 15:18:33 -04:00
|
|
|
case Type::DOWN:
|
2021-06-16 13:11:00 -04:00
|
|
|
sprite.setFillColor(sf::Color(0, 255, 0));
|
|
|
|
break;
|
|
|
|
|
2021-06-23 15:18:33 -04:00
|
|
|
case Type::LEFT:
|
2021-06-16 13:11:00 -04:00
|
|
|
sprite.setFillColor(sf::Color(0, 0, 255));
|
|
|
|
break;
|
|
|
|
|
2021-06-23 15:18:33 -04:00
|
|
|
case Type::RIGHT:
|
2021-06-16 13:11:00 -04:00
|
|
|
sprite.setFillColor(sf::Color(255, 0, 255));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: // yellow
|
|
|
|
sprite.setFillColor(sf::Color(255, 239, 0));
|
|
|
|
}
|
|
|
|
|
2021-10-04 10:20:24 -04:00
|
|
|
return std::make_shared<ClassicSprite>(sprite);
|
2021-06-16 13:11:00 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|