2021-06-16 19:11:00 +02:00
|
|
|
#include "classicgraphicsmanager.h"
|
|
|
|
#include "classicnote.h"
|
|
|
|
|
2021-06-23 21:18:33 +02:00
|
|
|
ClassicGraphicsManager::ClassicGraphicsManager(sf::RenderTarget& target) :
|
|
|
|
_sprite_container({Type::UP, Type::DOWN,
|
|
|
|
Type::LEFT, Type::RIGHT},
|
|
|
|
std::make_unique<ClassicSpriteFactory>("VeraMono.ttf")),
|
|
|
|
_render_target(target)
|
2021-06-16 19:11:00 +02:00
|
|
|
{}
|
|
|
|
|
2021-06-24 00:43:13 +02:00
|
|
|
void ClassicGraphicsManager::initGraphics(ClassicNote* note)
|
2021-06-16 19:11:00 +02:00
|
|
|
{
|
2021-06-23 21:18:33 +02:00
|
|
|
note->setSprite(_sprite_container.getSprite(note->type()));
|
2021-06-24 20:04:09 +02:00
|
|
|
note->sprite()->setCoordinates(note->getCoordinates(), 0, 0);
|
2021-06-16 19:11:00 +02:00
|
|
|
}
|
|
|
|
|
2021-06-24 00:43:13 +02:00
|
|
|
void ClassicGraphicsManager::resetGraphics(ClassicNote* note)
|
2021-06-16 19:11:00 +02:00
|
|
|
{
|
2021-06-23 21:18:33 +02:00
|
|
|
_sprite_container.resetSprite(note->sprite(), note->type());
|
2021-06-24 20:04:09 +02:00
|
|
|
note->setSprite(nullptr);
|
2021-06-23 21:18:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ClassicGraphicsManager::draw(const ClassicNote *note)
|
|
|
|
{
|
|
|
|
_render_target.draw(*note->sprite());
|
2021-06-16 19:11:00 +02:00
|
|
|
}
|