Bomberman Multiplayer
Authoritative multiplayer networking layer for Bomberman.
Loading...
Searching...
No Matches
bomberman::Text Class Reference

Text object. More...

#include <Text.h>

Inheritance diagram for bomberman::Text:
[legend]

Public Member Functions

 Text (std::shared_ptr< TTF_Font > font, SDL_Renderer *renderer, const std::string &text)
 Construct a new Text object.
 
void setText (const std::string &text)
 Set the Text.
 
void setColor (const SDL_Color &color)
 Set the Color.
 
void fitToContent ()
 Resizes the render rect to the current glyph texture size.
 
- Public Member Functions inherited from bomberman::Object
 Object (SDL_Renderer *renderer)
 Construct a new object.
 
virtual ~Object ()
 Destroy the object.
 
void setSize (const int width, const int height)
 Set the Size of object.
 
void setPosition (const int x, const int y)
 Set the Position of object (integer)
 
void setPositionF (const float x, const float y)
 Set the Position of object (float/sub-pixel)
 
void setClip (const int width, const int height, const int x, const int y)
 Set the Clip of source texture.
 
void attachToCamera (bool isAttached=true)
 Attach object to camera movement.
 
void setVisible (bool isVisible)
 Toggle whether this object should currently be drawn.
 
bool isVisible () const
 Returns whether this object is currently drawable.
 
int getWidth () const
 Get the Width of object.
 
int getHeight () const
 Get the Height of object.
 
int getPositionX () const
 Get the Position X of object (integer)
 
int getPositionY () const
 Get the Position Y of object (integer)
 
float getPositionXF () const
 Get the Position X of object (float)
 
float getPositionYF () const
 Get the Position Y of object (float)
 
const SDL_Rect & getRect () const
 Get Rect of object.
 
SDL_FRect getRectF () const
 Get Rect of object (float position)
 
void setFlip (SDL_RendererFlip flip)
 Set the Flip object.
 
void setColorMod (Uint8 r, Uint8 g, Uint8 b)
 Set texture color modulation applied during draw.
 
virtual void update (const unsigned int delta)
 Update object.
 
void draw (const SDL_Rect &camera) const
 Draw object on the screen.
 

Additional Inherited Members

- Protected Attributes inherited from bomberman::Object
SDL_Renderer * renderer = nullptr
 
std::shared_ptr< SDL_Texture > texture = nullptr
 
SDL_Rect rect
 
SDL_Rect clip
 
SDL_RendererFlip flipping = SDL_FLIP_NONE
 
float positionX = 0.0f
 
float positionY = 0.0f
 
Uint8 colorModR = 0xFF
 
Uint8 colorModG = 0xFF
 
Uint8 colorModB = 0xFF
 

Detailed Description

Text object.

Constructor & Destructor Documentation

◆ Text()

bomberman::Text::Text ( std::shared_ptr< TTF_Font >  font,
SDL_Renderer *  renderer,
const std::string &  text 
)

Construct a new Text object.

Parameters
font- SDL2_TTF font
renderer- SDL2 renderer
text- text to draw on the screen

Member Function Documentation

◆ fitToContent()

void bomberman::Text::fitToContent ( )

Resizes the render rect to the current glyph texture size.

Useful for text that should keep its natural width/height and avoid stretching.

◆ setColor()

void bomberman::Text::setColor ( const SDL_Color &  color)

Set the Color.

Parameters
color- color of text

◆ setText()

void bomberman::Text::setText ( const std::string &  text)

Set the Text.

Parameters
text- text to draw on the screen

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