-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathButton.hpp
More file actions
41 lines (33 loc) · 986 Bytes
/
Button.hpp
File metadata and controls
41 lines (33 loc) · 986 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef BUTTON_HPP
#define BUTTON_HPP
#include <SFML/Graphics.hpp>
namespace gui {
class Button : public sf::Drawable
{
public:
Button(const sf::Texture & texture,
const sf::IntRect & texRectNormal,
const sf::IntRect & texRectFocused
);
Button(const sf::Texture & texture,
const sf::IntRect & texRectNormal,
const sf::IntRect & texRectFocused,
const sf::IntRect & texRectClicked
);
void setPosition(const sf::Vector2f & position);
void setVisible(bool visible);
void setEnable(bool enable);
bool update(sf::Vector2f mousePosition, bool mouseButtonPressed);
private:
void draw(sf::RenderTarget &target, sf::RenderStates states) const;
const sf::IntRect mTexRectNormal;
const sf::IntRect mTexRectFocused;
const sf::IntRect mTexRectClicked;
sf::Sprite mSprite;
bool mOldMouseButtonState;
bool mIsVisible;
bool mHasStartedClick;
bool mEnable;
};
}
#endif // BUTTON_HPP