diff --git a/src/gui/editor.cpp b/src/gui/editor.cpp index 9048386..1f33bcd 100644 --- a/src/gui/editor.cpp +++ b/src/gui/editor.cpp @@ -43,7 +43,7 @@ Editor::Editor(sf::RenderWindow& game_window, Callbacks&& callbacks, std::unique test_menu->addCascadeButton(test_cascade_button); test_menu->addPushButton(quit_button); - test_cascade_button->resetRect(test_menu_2); + test_cascade_button->resetRect(); _music->openFromFile("Uta-test.flac"); _music->setVolume(5); diff --git a/src/gui/widgets/cascademenubutton.cpp b/src/gui/widgets/cascademenubutton.cpp index aeae40a..bdea938 100644 --- a/src/gui/widgets/cascademenubutton.cpp +++ b/src/gui/widgets/cascademenubutton.cpp @@ -41,13 +41,13 @@ void CascadeMenuButton::input(const sf::Event& event) void CascadeMenuButton::setRect(const sf::FloatRect& rect) { Button::setRect(rect); - resetRect(_submenu); + resetRect(); } void CascadeMenuButton::setSubmenu(const std::shared_ptr& submenu) { _submenu = submenu; - resetRect(_submenu); + resetRect(); } const std::shared_ptr CascadeMenuButton::submenu() const @@ -55,11 +55,11 @@ const std::shared_ptr CascadeMenuButton::submenu() const return _submenu; } -void CascadeMenuButton::resetRect(const std::shared_ptr& submenu) +void CascadeMenuButton::resetRect() { - if (submenu) + if (_submenu) { - submenu->setPosition({_button_content.getPosition().x + _button_content.getSize().x, + _submenu->setPosition({_button_content.getPosition().x + _button_content.getSize().x, _button_content.getPosition().y}); } } diff --git a/src/gui/widgets/cascademenubutton.h b/src/gui/widgets/cascademenubutton.h index 76f7869..352df4f 100644 --- a/src/gui/widgets/cascademenubutton.h +++ b/src/gui/widgets/cascademenubutton.h @@ -13,7 +13,7 @@ public: void setSubmenu(const std::shared_ptr& submenu); const std::shared_ptr submenu() const; - void resetRect(const std::shared_ptr& submenu); + void resetRect(); void setFillColors(sf::Color&& idle_color, sf::Color&& hover_color); private: