class Button -
More...
#include <Button.hpp>
|
std::string | operator() () |
| operator() More...
|
|
| Button (sf::Vector2f buttonSize, sf::Vector2f buttonPos, sf::Color buttonColor, bool border=false) |
| Constructor. More...
|
|
void | setText (int textSize, sf::Vector2f textOffset, std::string text, sf::Font &font, int size=0) |
| Set the text of the Button. More...
|
|
void | addChar (std::string ch) |
| Add a char to the text. More...
|
|
void | delChar () |
| Delete a char to the text.
|
|
void | centerText (bool centerAllAxis=true, sf::Vector2f textOffset={0, 0}) |
| Center the text. More...
|
|
void | setActive () |
| Put the border into red border.
|
|
void | setInactive () |
| Put the border into black border.
|
|
bool | clickButton () |
| Click on the button.
|
|
void | drawButton (std::shared_ptr< sf::RenderWindow > window) |
| Draw a button with its text on a window. More...
|
|
|
std::shared_ptr< sf::RectangleShape > | buttonRect |
|
std::shared_ptr< sf::Text > | buttonText |
|
bool | redBorder |
|
int | maxTextSize |
|
◆ Button()
Button::Button |
( |
sf::Vector2f |
buttonSize, |
|
|
sf::Vector2f |
buttonPos, |
|
|
sf::Color |
buttonColor, |
|
|
bool |
border = false |
|
) |
| |
Constructor.
Constructor of Button class
- Parameters
-
buttonSize | size of the Button |
buttonPos | position of the Button |
buttonColor | color of the Button |
border | true if the border is red, false if the border is black |
◆ addChar()
void Button::addChar |
( |
std::string |
ch | ) |
|
Add a char to the text.
- Parameters
-
◆ centerText()
void Button::centerText |
( |
bool |
centerAllAxis = true , |
|
|
sf::Vector2f |
textOffset = {0, 0} |
|
) |
| |
Center the text.
- Parameters
-
centerAllAxis | true if you also want to center on y Axis |
textOffset | offset on x |
◆ drawButton()
void Button::drawButton |
( |
std::shared_ptr< sf::RenderWindow > |
window | ) |
|
Draw a button with its text on a window.
- Parameters
-
window | Window on which the button is drawn |
◆ operator()()
std::string Button::operator() |
( |
| ) |
|
operator()
Return the button text
◆ setText()
void Button::setText |
( |
int |
textSize, |
|
|
sf::Vector2f |
textOffset, |
|
|
std::string |
text, |
|
|
sf::Font & |
font, |
|
|
int |
size = 0 |
|
) |
| |
Set the text of the Button.
- Parameters
-
textSize | size of the text |
textOffset | offset of the text |
text | text of the Button |
font | font of the text |
The documentation for this class was generated from the following files: