Bomberman Multiplayer
Authoritative multiplayer networking layer for Bomberman.
Loading...
Searching...
No Matches
Text.h
1#ifndef _BOMBERMAN_ENTITIES_TEXT_H_
2#define _BOMBERMAN_ENTITIES_TEXT_H_
3
4#include <SDL_ttf.h>
5
6#include "Entities/Object.h"
7
8namespace bomberman
9{
14 class Text : public Object
15 {
16 public:
24 Text(std::shared_ptr<TTF_Font> font, SDL_Renderer* renderer, const std::string& text);
30 void setText(const std::string& text);
36 void setColor(const SDL_Color& color);
42 void fitToContent();
43
44 private:
49 void loadText();
50
51 std::shared_ptr<TTF_Font> font = nullptr; // SDL2 font
52 std::string text; // text to display
53 SDL_Color color = {255, 255, 255, 255}; // color of text
54 };
55} // namespace bomberman
56
57#endif // _BOMBERMAN_ENTITIES_TEXT_H_
Base class for objects.
Definition Object.h:14
Text object.
Definition Text.h:15
void setText(const std::string &text)
Set the Text.
Definition Text.cpp:16
void setColor(const SDL_Color &color)
Set the Color.
Definition Text.cpp:23
void fitToContent()
Resizes the render rect to the current glyph texture size.
Definition Text.cpp:30