2021-08-16 20:54:03 +02:00
|
|
|
#include "menudrop.h"
|
|
|
|
|
|
|
|
void MenuDrop::input(const sf::Event &event)
|
|
|
|
{
|
|
|
|
for (auto& child : _children)
|
|
|
|
child->input(event);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuDrop::update()
|
|
|
|
{
|
|
|
|
for (auto& child : _children)
|
|
|
|
child->update();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuDrop::draw(sf::RenderTarget& target, sf::RenderStates states) const
|
|
|
|
{
|
|
|
|
if (!_is_visible)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (auto& child : _children)
|
|
|
|
child->draw(target, states);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuDrop::setRect(const sf::FloatRect& rect)
|
|
|
|
{
|
|
|
|
(void)rect;
|
|
|
|
/*_bar_rect.setPosition(rect.left, rect.top);
|
|
|
|
_bar_rect.setSize({rect.width, rect.height});
|
|
|
|
|
|
|
|
_bar_button_rect.setSize(sf::Vector2f(100, _bar_rect.getSize().y));*/
|
|
|
|
}
|
|
|
|
|
|
|
|
void MenuDrop::setPosition(const sf::Vector2f& position)
|
|
|
|
{
|
|
|
|
(void)position;
|
|
|
|
//_bar_rect.setPosition(position);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool MenuDrop::isUnderMouse(int mouse_x, int mouse_y) const
|
|
|
|
{
|
|
|
|
(void)mouse_x;
|
|
|
|
(void)mouse_y;
|
|
|
|
return false;//_bar_rect.getGlobalBounds().contains(mouse_x, mouse_y);
|
|
|
|
}
|
2021-08-20 20:33:23 +02:00
|
|
|
|
|
|
|
void MenuDrop::trigger()
|
|
|
|
{
|
|
|
|
bool new_visibility = !_is_visible;
|
|
|
|
|
|
|
|
setVisibility(new_visibility);
|
|
|
|
for (const auto& child : _children)
|
|
|
|
child->setVisibility(new_visibility);
|
|
|
|
}
|