You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
project-kyoku/src/modes/classicmode/graphics/classicselection.cpp

35 lines
721 B
C++

#include "classicselection.h"
#include "classicsprite.h"
ClassicSelection::ClassicSelection(ClassicSelection::Init&& init) :
_fill_color(init.color),
_shape(init.shape)
{
_shape->setColor(init.color);
}
void ClassicSelection::reset()
{
_shape->setPosition(kku::Point{0, 0});
_shape->setColor(kku::Color{0, 0, 0, 0});
}
void ClassicSelection::display() const
{
_shape->display();
}
void ClassicSelection::adjustTo(const std::shared_ptr<ClassicSprite>& sprite)
{
_shape->setRect(sprite->getRectangle()->getRect());
}
void ClassicSelection::toggle(bool selected)
{
_fill_color.alpha = selected
? 120
: 0;
_shape->setColor(_fill_color);
}