Skip to content

Class i_2D::TextBox

ClassList > i_2D > TextBox

More...

Public Functions

Type Name
bool Contains (sf::Vector2f point) const
Checks if a point is within the TextBox .
void DrawTo (sf::RenderWindow & window)
Draws the text to the render window.
std::string GetText ()
Get the string that was input by user.
bool IsSelected () const
Checks if TextBox is active.
void SetFont (const sf::Font & font)
Set the font of the TextBox .
void SetLimit (bool ToF)
Set the limit of the TextBox .
void SetLimit (bool ToF, int lim)
Set the limit of the TextBox .
void SetPosition (sf::Vector2f pos)
The position of the TextBox .
void SetSelected (bool sel)
Setter for isSelected, updates the text displayed in the box.
void SetString (const std::string & s)
Set the string of the text.
TextBox () = default
TextBox (const sf::Font & font, int size=25, sf::Color color=sf::Color::Red, bool sel=false)
Constructor.
void TypedOn (sf::Event input)
TypedOn event handler.

Detailed Description

is where users write to interface and the world

Public Functions Documentation

function Contains

Checks if a point is within the TextBox .

inline bool i_2D::TextBox::Contains (
    sf::Vector2f point
) const

Parameters:

  • point an xy point to check the location of

Returns:

True if the point is in bounds, False otherwise

function DrawTo

Draws the text to the render window.

void i_2D::TextBox::DrawTo (
    sf::RenderWindow & window
) 

Parameters:

  • window The render window to be drawn on

function GetText

Get the string that was input by user.

inline std::string i_2D::TextBox::GetText () 

Returns:

Return the string

function IsSelected

Checks if TextBox is active.

inline bool i_2D::TextBox::IsSelected () const

Returns:

True if active, else False

function SetFont

Set the font of the TextBox .

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

Parameters:

  • font The font to be set to

function SetLimit [1/2]

Set the limit of the TextBox .

inline void i_2D::TextBox::SetLimit (
    bool ToF
) 

Parameters:

  • ToF True of False

function SetLimit [2/2]

Set the limit of the TextBox .

inline void i_2D::TextBox::SetLimit (
    bool ToF,
    int lim
) 

Parameters:

  • ToF True or False
  • lim The limit of the TextBox

function SetPosition

The position of the TextBox .

inline void i_2D::TextBox::SetPosition (
    sf::Vector2f pos
) 

Parameters:

  • pos The position to be set to

function SetSelected

Setter for isSelected, updates the text displayed in the box.

void i_2D::TextBox::SetSelected (
    bool sel
) 

Parameters:

  • sel whether the TextBox is to be set selected or not

function SetString

Set the string of the text.

void i_2D::TextBox::SetString (
    const std::string & s
) 

Parameters:

  • s The string to be set to

function TextBox [1/2]

i_2D::TextBox::TextBox () = default

function TextBox [2/2]

Constructor.

explicit i_2D::TextBox::TextBox (
    const sf::Font & font,
    int size=25,
    sf::Color color=sf::Color::Red,
    bool sel=false
) 

Parameters:

  • font The font used by TextBox
  • size The size of the text
  • color The color of the text
  • sel Set the activity of TextBox

function TypedOn

TypedOn event handler.

void i_2D::TextBox::TypedOn (
    sf::Event input
) 

Parameters:

  • input the new text that has been typed into the TextBox

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