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.
69 lines
1.5 KiB
C++
69 lines
1.5 KiB
C++
#include "bpmslider.h"
|
|
|
|
BPMSlider::BPMSlider(const std::shared_ptr<kku::CoreFactory> &factory)
|
|
{
|
|
_slider_background = factory->getRectangle();
|
|
_slider_tick = factory->getRectangle();
|
|
|
|
_slider_background->setColor(kku::Color{0, 0, 0, 255});
|
|
_slider_tick->setColor(kku::Color{255, 0, 0, 255});
|
|
}
|
|
|
|
void BPMSlider::input(const kku::SystemEvent &event)
|
|
{
|
|
Widget::input(event);
|
|
}
|
|
|
|
void BPMSlider::update(const kku::microsec &dt)
|
|
{
|
|
Widget::update(dt);
|
|
}
|
|
|
|
void BPMSlider::display() const
|
|
{
|
|
_slider_background->display();
|
|
_slider_tick->display();
|
|
Widget::display();
|
|
}
|
|
|
|
void BPMSlider::setRect(const kku::Area<float> &rect)
|
|
{
|
|
_slider_background->setRect(rect);
|
|
_slider_tick->setRect(
|
|
kku::Area<float>{rect.left, rect.top, rect.width / 30.f, rect.height});
|
|
}
|
|
|
|
void BPMSlider::setPosition(const kku::Point &position)
|
|
{
|
|
_slider_background->setPosition(position);
|
|
_slider_tick->setPosition(position);
|
|
}
|
|
|
|
void BPMSlider::move(const kku::Vector2<float> &delta)
|
|
{
|
|
_slider_background->move(delta);
|
|
_slider_tick->move(delta);
|
|
}
|
|
|
|
bool BPMSlider::isUnderMouse(const kku::Point &position) const
|
|
{
|
|
return _slider_background->contains(position);
|
|
}
|
|
|
|
kku::Area<float> BPMSlider::getRect() const
|
|
{
|
|
return _slider_background->getRect();
|
|
}
|
|
|
|
kku::Point BPMSlider::getPosition() const
|
|
{
|
|
return _slider_background->getPosition();
|
|
}
|
|
|
|
void BPMSlider::setTickPosition(float x_position)
|
|
{
|
|
_slider_tick->setPosition(
|
|
kku::Point{_slider_background->getPosition().x + x_position,
|
|
_slider_tick->getPosition().y});
|
|
}
|