forked from NaiJi/project-kyoku
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
953 B
C++
30 lines
953 B
C++
#pragma once
|
|
|
|
#include "widget.h"
|
|
#include <functional>
|
|
#include <SFML/Graphics/RectangleShape.hpp>
|
|
#include <SFML/Graphics/Text.hpp>
|
|
|
|
class Button : public Widget
|
|
{
|
|
public:
|
|
explicit Button(const std::string& text, const std::shared_ptr<sf::Font>& font, unsigned int font_size);
|
|
|
|
virtual void input(const sf::Event& event) override = 0;
|
|
virtual void update(const sf::Time& dt) override final;
|
|
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override final;
|
|
virtual void setPosition(const sf::Vector2f& position) override final;
|
|
virtual void move(const sf::Vector2f& delta) override final;
|
|
virtual bool isUnderMouse(int mouse_x, int mouse_y) const override final;
|
|
|
|
virtual void setRect(const sf::FloatRect& rect) override;
|
|
|
|
virtual void setText(const std::string& text);
|
|
|
|
protected:
|
|
sf::RectangleShape _button_content;
|
|
sf::Text _button_text;
|
|
std::shared_ptr<sf::Font> _font;
|
|
};
|
|
|