project-kyoku/src/gui/widgets/bpmcalculatorwidget.h

34 lines
971 B
C
Raw Normal View History

2021-08-16 20:54:03 +02:00
#pragma once
#include "window.h"
#include "bpmslider.h"
#include "pushbutton.h"
2021-08-16 20:54:03 +02:00
#include <functional>
#include <SFML/Graphics/RectangleShape.hpp>
#include <SFML/Graphics/Text.hpp>
class BPMCalculator;
class BPMCalculatorWidget : public Window
2021-08-16 20:54:03 +02:00
{
public:
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;
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 void move(const sf::Vector2f& delta) override;
2021-08-16 20:54:03 +02:00
void init();
2021-08-16 20:54:03 +02:00
private:
std::shared_ptr<PushButton> _button_start;
std::shared_ptr<BPMCalculator> _bpm_calculator;
std::shared_ptr<BPMSlider> _slider;
sf::Text _bpm_value;
2021-08-16 20:54:03 +02:00
};