#include <Button.h>
Public Member Functions | |
| Button () | |
| Button (std::string t, Vector2f size, int charSize, std::string bTexture, Color textColour, bool animated=false) | |
| void | setFont (Font &font) |
| constructor for button | |
| void | setBackgroundTexture (std::string bTexture) |
| set the font of the text on the button | |
| void | setTextColour (Color color) |
| set the background colour of the button | |
| void | setPosition (Vector2f pos) |
| set the colour of the text on the button | |
| void | drawTo (sf::RenderWindow &window) |
| set the position of the button and the text | |
| bool | isMouseOver (RenderWindow &window) |
| display the button and the text | |
| void | centerText () |
| check to see if the moust is hovering over the button | |
| void | adjustScale () |
Public Attributes | |
| bool | isAnimated = false |
|
inline |
| Button::Button | ( | std::string | t, |
| Vector2f | size, | ||
| int | charSize, | ||
| std::string | bTexture, | ||
| Color | textColour, | ||
| bool | animated = false ) |
set the text in our button
set the Colour of our button
Set base text size
set the size of the button
Set base size of button
set the colour of the button
Is the button animated
| void Button::adjustScale | ( | ) |
Stop scaling if already scaled
Scale button size
Scale position
Scale text
Center the text
| void Button::centerText | ( | ) |
check to see if the moust is hovering over the button
| void Button::drawTo | ( | sf::RenderWindow & | window | ) |
set the position of the button and the text
| bool Button::isMouseOver | ( | RenderWindow & | window | ) |
display the button and the text
Get mouse position
| void Button::setBackgroundTexture | ( | std::string | bTexture | ) |
set the font of the text on the button
button is of type RectangleShape and RectangleShape stores a pointer to a texture rather than owning it directly, hence it requires the memory adress of the butting button.setTexture(&buttonTexture);
| void Button::setFont | ( | Font & | font | ) |
constructor for button
| void Button::setPosition | ( | Vector2f | pos | ) |
set the colour of the text on the button
Set base button position
Center the text
| void Button::setTextColour | ( | Color | color | ) |
set the background colour of the button
| bool Button::isAnimated = false |