-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbutton.hpp
More file actions
45 lines (35 loc) · 855 Bytes
/
button.hpp
File metadata and controls
45 lines (35 loc) · 855 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
#pragma once
#include<iostream>
#include<vector>
#include<fstream>
#include<sstream>
#include<stack>
#include<map>
#include<SFML/Graphics.hpp>
#include<SFML/System.hpp>
#include<SFML/Window.hpp>
#include<SFML/Audio.hpp>
#include<SFML/Network.hpp>
enum button_states{BTN_IDLE = 0, BTN_HOVER, BTN_ACTIVE};
class Button{
private:
//Variables
int buttonState;
sf::RectangleShape shape;
sf::Font* font;
sf::Text text;
sf::Color idleColor;
sf::Color hoverColor;
sf::Color activeColor;
//Init functions
public:
//Constructors
Button(float x, float y, float width, float height, sf::Font* font, std::string text,
sf::Color idleColor,sf::Color hoverColor,sf::Color activeColor);
virtual ~Button();
//Accessors
const bool isPressed() const;
//Functions
void update(const sf::Vector2f mousePos);
void render(sf::RenderTarget* target);
};