2021-08-16 20:54:03 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "widget.h"
|
2021-08-27 19:40:48 +02:00
|
|
|
#include "bpmslider.h"
|
2021-08-16 20:54:03 +02:00
|
|
|
#include <functional>
|
|
|
|
#include <SFML/Graphics/RectangleShape.hpp>
|
|
|
|
#include <SFML/Graphics/Text.hpp>
|
|
|
|
|
2021-08-27 19:40:48 +02:00
|
|
|
class BPMCalculator;
|
|
|
|
|
2021-08-21 14:29:58 +02:00
|
|
|
class BPMCalculatorWidget : public Widget
|
2021-08-16 20:54:03 +02:00
|
|
|
{
|
|
|
|
public:
|
2021-08-27 19:40:48 +02:00
|
|
|
explicit BPMCalculatorWidget(const std::shared_ptr<BPMCalculator>& bpm_calculator, const std::shared_ptr<sf::Font> &font);
|
2021-08-16 20:54:03 +02:00
|
|
|
|
|
|
|
virtual void input(const sf::Event& event) override;
|
2021-08-27 19:40:48 +02:00
|
|
|
virtual void update(const sf::Time& dt) override;
|
2021-08-16 20:54:03 +02:00
|
|
|
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
|
|
|
|
virtual void setRect(const sf::FloatRect& rect) override;
|
|
|
|
virtual void setPosition(const sf::Vector2f& position) override;
|
|
|
|
virtual bool isUnderMouse(int mouse_x, int mouse_y) const override;
|
|
|
|
|
|
|
|
private:
|
2021-08-27 19:40:48 +02:00
|
|
|
std::shared_ptr<BPMCalculator> _bpm_calculator;
|
|
|
|
std::shared_ptr<BPMSlider> _slider;
|
|
|
|
|
|
|
|
sf::RectangleShape _widget_window;
|
2021-08-16 20:54:03 +02:00
|
|
|
|
|
|
|
std::function<void(void)> _on_click_callback;
|
|
|
|
};
|
|
|
|
|