EchoesOfFate
A game for our COMP315 Project
 
Loading...
Searching...
No Matches
Button.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4#include <SFML/Graphics.hpp>
5
6using namespace sf;
7
8class Button {
9public:
10 Button() {};
11
12 Button(std::string t, Vector2f size, int charSize, std::string bTexture, Color textColour, bool animated = false);
13 void setFont(Font& font);
14 void setBackgroundTexture(std::string bTexture);
15 void setTextColour(Color color);
16 void setPosition(Vector2f pos);
17 void drawTo(sf::RenderWindow& window);
18 bool isMouseOver(RenderWindow& window);
19 void centerText();
20 bool isAnimated = false;
21 void adjustScale();
22
23private:
24 RectangleShape button;
25 Text text;
26 Texture buttonTexture;
27 Vector2f baseSize;
28 Vector2f basePosition;
29 unsigned int baseTextSize;
30};
bool isAnimated
Definition Button.h:20
void drawTo(sf::RenderWindow &window)
set the position of the button and the text
Definition Button.cpp:42
Button()
Definition Button.h:10
void setFont(Font &font)
constructor for button
Definition Button.cpp:20
void setTextColour(Color color)
set the background colour of the button
Definition Button.cpp:30
void adjustScale()
Definition Button.cpp:71
void centerText()
check to see if the moust is hovering over the button
Definition Button.cpp:61
bool isMouseOver(RenderWindow &window)
display the button and the text
Definition Button.cpp:54
void setBackgroundTexture(std::string bTexture)
set the font of the text on the button
Definition Button.cpp:24
void setPosition(Vector2f pos)
set the colour of the text on the button
Definition Button.cpp:34