1 #ifndef RAYLIB_CPP_INCLUDE_TEXT_HPP_
2 #define RAYLIB_CPP_INCLUDE_TEXT_HPP_
6 #include "./raylib.hpp"
7 #include "./RaylibException.hpp"
8 #include "./raylib-cpp-utils.hpp"
51 const std::string&
text =
"",
53 const ::Color&
color = WHITE,
54 const ::Font&
font = ::GetFontDefault(),
75 const std::string&
text =
"",
78 const ::Color&
color = WHITE) :
103 inline void Draw(
int posX,
int posY)
const {
106 { static_cast<float>(posX), static_cast<float>(posY) },
117 inline void Draw(const ::Vector2& position,
float rotation, const ::Vector2& origin = {0, 0})
const {
125 return ::MeasureText(
text.c_str(),
static_cast<int>(
fontSize));
135 Text& operator=(
const Text& other) {
136 if (
this == &other) {
155 const std::string&
text,
159 const ::Color&
color) {
169 const std::string&
text,
170 const ::Vector2& pos,
172 const ::Color&
color) {
183 const std::string&
text,
184 const ::Vector2& position,
187 const ::Color&
color) {
198 const std::string&
text,
199 const ::Vector2& position,
200 const ::Vector2& origin,
201 const float rotation,
204 const ::Color&
color) {
Font type, includes texture and charSet array data.
float fontSize
The size of the text.
Text(const ::Font &font, const std::string &text="", float fontSize=10, float spacing=0, const ::Color &color=WHITE)
Initializes a new Text object with a custom font.
static void Draw(const std::string &text, const ::Vector2 &pos, const int fontSize, const ::Color &color)
Draw text using font and color, with position defined as Vector2.
static void Draw(const ::Font &font, const std::string &text, const ::Vector2 &position, const float fontSize, const float spacing, const ::Color &color)
Draw text using font, color, position, font size and spacing.
float spacing
The character spacing for the text.
int Measure()
Measure string width for default font.
::Font font
The internal raylib font to use for the text.
Text(const std::string &text="", float fontSize=10, const ::Color &color=WHITE, const ::Font &font=::GetFontDefault(), float spacing=0)
Initializes a new Text object.
static void Draw(const std::string &text, const int posX, const int posY, const int fontSize, const ::Color &color)
Draw text using font and color.
Vector2 MeasureEx()
Measure string size for Font.
::Color color
The color of the text.
std::string text
The internal text.
static void Draw(const ::Font &font, const std::string &text, const ::Vector2 &position, const ::Vector2 &origin, const float rotation, const float fontSize, const float spacing, const ::Color &color)
Draw text using font, color, position, origin, font size and spacing.
void Draw(const ::Vector2 &position, float rotation, const ::Vector2 &origin={0, 0}) const
Draw text using Font and pro parameters (rotation).
void Draw(int posX, int posY) const
Draw text with values in class.
void Draw(const ::Vector2 &position) const
Draw text with values in class.
All raylib-cpp classes and functions appear in the raylib namespace.
static void DrawText(const std::string &text, int posX, int posY, int fontSize, ::Color color)
Draw text (using default font)
static void DrawTextPro(const Font &font, const std::string &text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, ::Color tint)
Draw text using Font and pro parameters (rotation)
static void DrawTextEx(const Font &font, const std::string &text, Vector2 position, float fontSize, float spacing, ::Color tint)
Draw text using font and additional parameters.