AsloEngine/asloengine/builtin/text_only_button.cpp
2019-08-29 18:42:28 +02:00

44 lines
No EOL
842 B
C++
Executable file

#include "headers/text_only_button.hpp"
namespace asloengine
{
TextOnlyButton::TextOnlyButton(sf::String _name, sf::String _text, sf::Font& _font, uint _text_size)
: TextObject(_name, _text, _font, _text_size), GameObject(_name), Clickable(sf::Mouse::Left) {}
TextOnlyButton::~TextOnlyButton() {}
void TextOnlyButton::draw()
{
TextObject::draw();
}
void TextOnlyButton::on_main_property_update()
{
TextObject::on_main_property_update();
update_clickable(text->getGlobalBounds());
}
void TextOnlyButton::on_start()
{
set_clickable(text->getGlobalBounds(), render_window);
}
void TextOnlyButton::on_update(float delta_time)
{
if (clicked_press_and_release())
{
signal_on_clicked();
}
}
}