-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathButton.h
More file actions
45 lines (33 loc) · 888 Bytes
/
Button.h
File metadata and controls
45 lines (33 loc) · 888 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
42
43
44
45
//
// Created by danit on 04.11.2022.
//
#ifndef OOP_BUTTON_H
#define OOP_BUTTON_H
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <iostream>
#include <string>
class Button {
private:
/// Variables
enum button_states {
IDLE = 0, HOVER, PRESSED
};
short unsigned buttonState;
sf::RectangleShape shape;
sf::Font font;
sf::Text text;
sf::Color idleColor;
sf::Color hoverColor;
sf::Color pressedColor;
public:
/// Constructor / Destructor
Button(float width, float height, float x, float y, const sf::Font &font, const std::string &text,
const sf::Color &idleColor, const sf::Color &hoverColor, const sf::Color &pressedColor);
/// Getters
bool isPressed() const;
/// Functions
void update(sf::Vector2f mousePos);
void render(sf::RenderTarget &target);
};
#endif //OOP_BUTTON_H