Skip to content

Class i_2D::Button

ClassList > i_2D > Button

Public Functions

Type Name
Button (const std::string & t, sf::Vector2f size, sf::Color bgColor, sf::Color textColor, const sf::Font & font)
Construct the text with font. Then set text and shape properties with params.
void DrawTo (sf::RenderWindow & window)
draws the button onto the window
bool IsMouseOver (sf::RenderWindow & window)
checks if mouse position is in a button
void SetBackColor (sf::Color color)
set the background color of the button
void SetButtonSize (sf::Vector2f size)
set the button size
void SetFont (const sf::Font & font)
set the font of the button
void SetMFont (const sf::Font & font)
set the font of the button
void SetPosition (sf::Vector2f pos)
set the position of the button
void SetString (const std::string & s)
set the string of the button
void SetTextColor (sf::Color color)
set the text color of the string

Public Functions Documentation

function Button

Construct the text with font. Then set text and shape properties with params.

i_2D::Button::Button (
    const std::string & t,
    sf::Vector2f size,
    sf::Color bgColor,
    sf::Color textColor,
    const sf::Font & font
) 

Constructs the button

Parameters:

  • t the string to be displayed by button
  • size the size of the rectangle shape
  • bgColor the background color of the shape
  • textColor the color of the text
  • font the font style

function DrawTo

draws the button onto the window

inline void i_2D::Button::DrawTo (
    sf::RenderWindow & window
) 

Parameters:

  • window

function IsMouseOver

checks if mouse position is in a button

bool i_2D::Button::IsMouseOver (
    sf::RenderWindow & window
) 

Parameters:

  • window

Returns:

returns turn if mouse position is in the button

function SetBackColor

set the background color of the button

inline void i_2D::Button::SetBackColor (
    sf::Color color
) 

Parameters:

  • color

function SetButtonSize

set the button size

inline void i_2D::Button::SetButtonSize (
    sf::Vector2f size
) 

Parameters:

  • size

function SetFont

set the font of the button

inline void i_2D::Button::SetFont (
    const sf::Font & font
) 

Parameters:

  • font

function SetMFont

void i_2D::Button::SetMFont (
    const sf::Font & font
) 

function SetPosition

set the position of the button

void i_2D::Button::SetPosition (
    sf::Vector2f pos
) 

Parameters:

  • pos position on the window

function SetString

set the string of the button

inline void i_2D::Button::SetString (
    const std::string & s
) 

Parameters:

  • s label of the button

function SetTextColor

set the text color of the string

inline void i_2D::Button::SetTextColor (
    sf::Color color
) 

Parameters:

  • color

The documentation for this class was generated from the following file source/Interfaces/Button.hpp