Remove unnecessary argument in resetRect of CascadeMenuButton

This commit is contained in:
NaiJi ✨ 2021-08-26 21:51:49 +03:00
parent 4093963706
commit 788cd090f2
3 changed files with 7 additions and 7 deletions

View File

@ -43,7 +43,7 @@ Editor::Editor(sf::RenderWindow& game_window, Callbacks&& callbacks, std::unique
test_menu->addCascadeButton(test_cascade_button); test_menu->addCascadeButton(test_cascade_button);
test_menu->addPushButton(quit_button); test_menu->addPushButton(quit_button);
test_cascade_button->resetRect(test_menu_2); test_cascade_button->resetRect();
_music->openFromFile("Uta-test.flac"); _music->openFromFile("Uta-test.flac");
_music->setVolume(5); _music->setVolume(5);

View File

@ -41,13 +41,13 @@ void CascadeMenuButton::input(const sf::Event& event)
void CascadeMenuButton::setRect(const sf::FloatRect& rect) void CascadeMenuButton::setRect(const sf::FloatRect& rect)
{ {
Button::setRect(rect); Button::setRect(rect);
resetRect(_submenu); resetRect();
} }
void CascadeMenuButton::setSubmenu(const std::shared_ptr<MenuDrop>& submenu) void CascadeMenuButton::setSubmenu(const std::shared_ptr<MenuDrop>& submenu)
{ {
_submenu = submenu; _submenu = submenu;
resetRect(_submenu); resetRect();
} }
const std::shared_ptr<MenuDrop> CascadeMenuButton::submenu() const const std::shared_ptr<MenuDrop> CascadeMenuButton::submenu() const
@ -55,11 +55,11 @@ const std::shared_ptr<MenuDrop> CascadeMenuButton::submenu() const
return _submenu; return _submenu;
} }
void CascadeMenuButton::resetRect(const std::shared_ptr<MenuDrop>& 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}); _button_content.getPosition().y});
} }
} }

View File

@ -13,7 +13,7 @@ public:
void setSubmenu(const std::shared_ptr<MenuDrop>& submenu); void setSubmenu(const std::shared_ptr<MenuDrop>& submenu);
const std::shared_ptr<MenuDrop> submenu() const; const std::shared_ptr<MenuDrop> submenu() const;
void resetRect(const std::shared_ptr<MenuDrop>& submenu); void resetRect();
void setFillColors(sf::Color&& idle_color, sf::Color&& hover_color); void setFillColors(sf::Color&& idle_color, sf::Color&& hover_color);
private: private: