-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbutton.h
More file actions
53 lines (39 loc) · 1.35 KB
/
Copy pathbutton.h
File metadata and controls
53 lines (39 loc) · 1.35 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
#pragma once
#include <iostream>
#include <vector>
#include <sstream>
#include "SFML/Graphics.hpp"
enum button_states{BUTTON_BASE = 0, BUTTON_HOVER, BUTTON_CLICK};
class Button
{
private:
short unsigned buttonState;
short unsigned id;
sf::RectangleShape shape;
sf::Font* font;
sf::Text text;
sf::Color textBaseColor;
sf::Color textHoverColor;
sf::Color textClickColor;
sf::Color baseColor;
sf::Color hoverColor;
sf::Color clickColor;
sf::Color outlineBaseColor;
sf::Color outlineHoverColor;
sf::Color outlineClickColor;
public:
Button(float x, float y, float width, float height,
sf::Font* font, std::string text, unsigned character_size,
sf::Color text_base_color, sf::Color text_hover_color, sf::Color text_click_color,
sf::Color base_color, sf::Color hover_color, sf::Color click_color,
sf::Color outline_base_color = sf::Color::Transparent, sf::Color outline_hover_color = sf::Color::Transparent, sf::Color outline_click_color = sf::Color::Transparent,
short unsigned id = 0);
~Button();
const bool isPressed() const;
const std::string getText() const;
const short unsigned& getId() const;
void setText(const std::string text);
void setId(const short unsigned id);
void update(const sf::Vector2f& mousePos);
void render(sf::RenderTarget* target);
};