2021-09-28 05:48:06 +02:00
|
|
|
#include "holdmanager.h"
|
2021-10-04 17:30:21 +02:00
|
|
|
#include "classicarrownote.h"
|
2021-09-28 05:48:06 +02:00
|
|
|
|
2021-10-04 17:30:21 +02:00
|
|
|
#include <iostream>
|
2021-09-28 05:48:06 +02:00
|
|
|
|
2021-10-04 17:30:21 +02:00
|
|
|
HoldManager::HoldManager(const std::shared_ptr<ClassicGraphicsManager>& graphics_manager) :
|
|
|
|
_graphics_manager(graphics_manager)
|
|
|
|
{}
|
|
|
|
|
|
|
|
void HoldManager::emplace(ClassicArrowNote* note)
|
|
|
|
{
|
|
|
|
_notes_on_hold.emplace_back(note);
|
|
|
|
}
|
|
|
|
|
|
|
|
void HoldManager::checkRelease(sf::Keyboard::Key released_key)
|
|
|
|
{
|
|
|
|
bool key_match = std::any_of(_notes_on_hold.begin(), _notes_on_hold.end(),
|
|
|
|
[released_key](const auto& note)
|
|
|
|
{
|
|
|
|
return note->isPressedAs(released_key);
|
|
|
|
});
|
|
|
|
|
|
|
|
if (key_match)
|
|
|
|
_notes_on_hold.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void HoldManager::drawHoldBar()
|
|
|
|
{
|
|
|
|
if (_notes_on_hold.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* taking proxy sprites for notes on hold
|
|
|
|
* and drawing on centered bar */
|
|
|
|
|
|
|
|
// _graphics_manager-> . . .
|
|
|
|
}
|