EchoesOfFate
A game for our COMP315 Project
 
Loading...
Searching...
No Matches
Button Class Reference

#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
 

Constructor & Destructor Documentation

◆ Button() [1/2]

Button::Button ( )
inline

◆ Button() [2/2]

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

Member Function Documentation

◆ adjustScale()

void Button::adjustScale ( )

Stop scaling if already scaled

Scale button size

Scale position

Scale text

Center the text

◆ centerText()

void Button::centerText ( )

check to see if the moust is hovering over the button

◆ drawTo()

void Button::drawTo ( sf::RenderWindow & window)

set the position of the button and the text

◆ isMouseOver()

bool Button::isMouseOver ( RenderWindow & window)

display the button and the text

Get mouse position

◆ setBackgroundTexture()

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);

◆ setFont()

void Button::setFont ( Font & font)

constructor for button

◆ setPosition()

void Button::setPosition ( Vector2f pos)

set the colour of the text on the button

Set base button position

Center the text

◆ setTextColour()

void Button::setTextColour ( Color color)

set the background colour of the button

Member Data Documentation

◆ isAnimated

bool Button::isAnimated = false

The documentation for this class was generated from the following files: