blob: 972e5c9182c9a9b0e65de28cbdc0d3977edd3edf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#pragma once
#include "Widget.hpp"
#include <string>
#include <functional>
namespace gsr {
class Button : public Widget {
public:
Button(mgl::vec2f size);
Button(const Button&) = delete;
Button& operator=(const Button&) = delete;
bool on_event(mgl::Event &event, mgl::Window &window) override;
void draw(mgl::Window &window) override;
mgl::vec2f get_size() const { return size; }
std::function<void()> on_click;
private:
mgl::vec2f size;
bool mouse_inside = false;
bool pressed_inside = false;
};
}
|