project-kyoku/modes/classicmode/game/classicgraphicsmanager.cpp

30 lines
912 B
C++

#include "classicgraphicsmanager.h"
#include "classicsprite.h"
ClassicGraphicsManager::ClassicGraphicsManager(sf::RenderTarget& target) :
_sprite_container({Type::UP, Type::DOWN,
Type::LEFT, Type::RIGHT},
std::make_unique<ClassicSpriteFactory>("VeraMono.ttf")),
_render_target(target)
{}
std::shared_ptr<ClassicSprite> ClassicGraphicsManager::getSprite(Type type)
{
return _sprite_container.getSprite(type);
}
void ClassicGraphicsManager::draw(const std::shared_ptr<ClassicSprite>& sprite)
{
_render_target.draw(*sprite);
}
void ClassicGraphicsManager::drawLine(const Coordinates &p1, const Coordinates &p2)
{
sf::VertexArray line(sf::LinesStrip, 2);
line[0].color = sf::Color::Yellow;
line[0].position = {p1.x + 10, p1.y};
line[1].color = sf::Color::Blue;
line[1].position = {p2.x + 10, p2.y};
_render_target.draw(line);
}