36 lines
752 B
C++
36 lines
752 B
C++
|
#include "cascademenubutton.h"
|
||
|
#include "menudrop.h"
|
||
|
|
||
|
CascadeMenuButton::CascadeMenuButton(const std::string& text) :
|
||
|
Button(text)
|
||
|
{}
|
||
|
|
||
|
void CascadeMenuButton::input(const sf::Event& event)
|
||
|
{
|
||
|
Button::input(event);
|
||
|
|
||
|
switch (event.type)
|
||
|
{
|
||
|
default:
|
||
|
break;
|
||
|
|
||
|
case sf::Event::MouseMoved:
|
||
|
if (isUnderMouse(event.mouseButton.x, event.mouseButton.y))
|
||
|
{
|
||
|
_button_content.setFillColor(sf::Color(84, 158, 253));
|
||
|
_submenu->lock();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
_button_content.setFillColor(sf::Color::White);
|
||
|
_submenu->unlock();
|
||
|
}
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void CascadeMenuButton::setSubmenu(const std::shared_ptr<MenuDrop>& submenu)
|
||
|
{
|
||
|
_submenu = submenu;
|
||
|
}
|