forked from NaiJi/project-kyoku
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.
52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
#include "bpmslider.h"
|
|
|
|
BPMSlider::BPMSlider()
|
|
{
|
|
_slider_background.setFillColor(sf::Color::Black);
|
|
_slider_tick.setFillColor(sf::Color::Red);
|
|
}
|
|
|
|
void BPMSlider::input(const sf::Event& event)
|
|
{
|
|
Widget::input(event);
|
|
}
|
|
|
|
void BPMSlider::update(const sf::Time& dt)
|
|
{
|
|
Widget::update(dt);
|
|
}
|
|
|
|
void BPMSlider::draw(sf::RenderTarget& target, sf::RenderStates states) const
|
|
{
|
|
target.draw(_slider_background, states);
|
|
target.draw(_slider_tick, states);
|
|
Widget::draw(target, states);
|
|
}
|
|
|
|
void BPMSlider::setRect(const sf::FloatRect& rect)
|
|
{
|
|
_slider_background.setPosition(rect.left, rect.top);
|
|
_slider_background.setSize({rect.width, rect.height});
|
|
|
|
_slider_tick.setPosition(rect.left, rect.top);
|
|
_slider_tick.setSize({rect.width / 30, rect.height});
|
|
}
|
|
|
|
void BPMSlider::setPosition(const sf::Vector2f& position)
|
|
{
|
|
_slider_background.setPosition(position);
|
|
_slider_tick.setPosition(position);
|
|
}
|
|
|
|
void BPMSlider::move(const sf::Vector2f& delta)
|
|
{
|
|
_slider_background.move(delta);
|
|
_slider_tick.move(delta);
|
|
}
|
|
|
|
bool BPMSlider::isUnderMouse(int mouse_x, int mouse_y) const
|
|
{
|
|
return mouse_x == mouse_y; // just to compile
|
|
}
|
|
|