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.
55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "core/time.h"
|
|
#include "core/text.h"
|
|
#include "window.h"
|
|
#include "bpmslider.h"
|
|
#include "pushbutton.h"
|
|
|
|
#include <functional>
|
|
|
|
class BPMCalculator;
|
|
class Editor;
|
|
|
|
class BPMCalculatorWidget : public Window
|
|
{
|
|
public:
|
|
|
|
struct Init
|
|
{
|
|
std::shared_ptr<PushButton> start;
|
|
std::shared_ptr<PushButton> stop;
|
|
std::shared_ptr<PushButton> apply;
|
|
std::function<kku::microsec(void)> current_time;
|
|
};
|
|
|
|
explicit BPMCalculatorWidget(const std::shared_ptr<BPMCalculator>& bpm_calculator, const std::shared_ptr<kku::CoreFactory>& factory);
|
|
|
|
virtual void input(const kku::SystemEvent& event) override;
|
|
virtual void update(const kku::microsec& dt) override;
|
|
virtual void display() const override;
|
|
virtual void move(const kku::Vector2<float>& delta) override;
|
|
|
|
virtual void setRect(const kku::Area<float>& rect) override;
|
|
virtual void setPosition(const kku::Point& position) override;
|
|
|
|
virtual void setVisibility(bool is_visible = true) override;
|
|
|
|
void init(Init&& init);
|
|
|
|
private:
|
|
std::shared_ptr<PushButton> _button_start;
|
|
std::shared_ptr<PushButton> _button_stop;
|
|
std::shared_ptr<PushButton> _button_apply;
|
|
|
|
std::shared_ptr<BPMCalculator> _bpm_calculator;
|
|
std::shared_ptr<BPMSlider> _slider;
|
|
|
|
const std::shared_ptr<kku::CoreFactory> _core_factory;
|
|
|
|
bool _ticked;
|
|
std::shared_ptr<kku::Text> _bpm_value;
|
|
std::function<kku::microsec(void)> _current_time;
|
|
};
|
|
|