mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
41 lines
539 B
C++
41 lines
539 B
C++
|
|
#ifndef BUTTON_H
|
|
#define BUTTON_H
|
|
|
|
#include "widget.h"
|
|
|
|
#include <SDL.h>
|
|
|
|
#include "core/rect2.h"
|
|
#include "renderer/sprite.h"
|
|
|
|
#include <functional>
|
|
|
|
class Button : public Widget {
|
|
public:
|
|
enum ButtonState {
|
|
BUTTON_STATE_UP,
|
|
BUTTON_STATE_HOVER,
|
|
BUTTON_STATE_DOWN,
|
|
BUTTON_STATE_OFF,
|
|
};
|
|
|
|
void _event(const SDL_Event &ev);
|
|
void _update(float delta);
|
|
void _render();
|
|
|
|
std::function<void(void)> on_click;
|
|
|
|
Button();
|
|
virtual ~Button();
|
|
|
|
ButtonState state;
|
|
|
|
Sprite *up;
|
|
Sprite *down;
|
|
Sprite *hover;
|
|
Sprite *off;
|
|
};
|
|
|
|
#endif
|