#include "editor.h" #include "widgets/button.h" #include "widgets/group.h" #include "widgets/menubar.h" #include "tools/bpmcalculator.h" #include Editor::Editor(sf::RenderWindow& game_window, Callbacks&& callbacks, std::unique_ptr&& music) : _menu_bar(std::make_shared()), _game_window(game_window), _music(std::move(music)), _bpm_calculator(std::make_unique(_music)) { (void)callbacks; const float window_width = game_window.getSize().x; //const float window_height = game_window.getSize().y; _menu_bar->setRect(sf::FloatRect(0, 0, window_width, 27)); } void Editor::input(const sf::Event& event) { _menu_bar->input(event); if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Space) { _bpm_calculator->click(); std::cout << _bpm_calculator->getCurrentApproximation() << '\n'; } } void Editor::update() { _menu_bar->update(); } void Editor::draw() const { _game_window.draw(*_menu_bar); } void Editor::enter() { _menu_bar->setVisibility(); } void Editor::leave() { _menu_bar->setVisibility(false); }