1#ifndef RAYLIB_CPP_INCLUDE_TEXT_HPP_
2#define RAYLIB_CPP_INCLUDE_TEXT_HPP_
7#include "./RaylibException.hpp"
8#include "./raylib-cpp-utils.hpp"
9#include "./RadiansDegrees.hpp"
10#include "./Vector2.hpp"
53 const std::string_view
text =
"",
55 const ::Color&
color = WHITE,
56 const ::Font&
font = ::GetFontDefault(),
77 const std::string_view
text =
"",
80 const ::Color&
color = WHITE) :
103 void Draw(
int posX,
int posY)
const {
107 {static_cast<float>(posX), static_cast<float>(posY)},
118 void Draw(const ::Vector2& position,
Degree rotation, const ::Vector2& origin = {0, 0})
const {
132 Text& operator=(
const Text& other) {
133 if (
this == &other) {
152 const std::string_view
text,
156 const ::Color&
color) {
166 const std::string_view
text,
167 const ::Vector2& pos,
169 const ::Color&
color) {
180 const std::string_view
text,
181 const ::Vector2& position,
184 const ::Color&
color) {
195 const std::string_view
text,
196 const ::Vector2& position,
197 const ::Vector2& origin,
201 const ::Color&
color) {
Degree type (allows automatic worry free conversion between radians and degrees)
Font type, includes texture and charSet array data.
float fontSize
The size of the text.
static void Draw(const std::string_view text, const int posX, const int posY, const int fontSize, const ::Color &color)
Draw text using font and color.
Vector2 MeasureEx() const
Measure string size for Font.
static void Draw(const std::string_view text, const ::Vector2 &pos, const int fontSize, const ::Color &color)
Draw text using font and color, with position defined as Vector2.
int Measure() const
Measure string width for default font.
static void Draw(const ::Font &font, const std::string_view text, const ::Vector2 &position, const ::Vector2 &origin, const Degree rotation, const float fontSize, const float spacing, const ::Color &color)
Draw text using font, color, position, origin, font size and spacing.
float spacing
The character spacing for the text.
void Draw(const ::Vector2 &position, Degree rotation, const ::Vector2 &origin={0, 0}) const
Draw text using Font and pro parameters (rotation).
static void Draw(const ::Font &font, const std::string_view text, const ::Vector2 &position, const float fontSize, const float spacing, const ::Color &color)
Draw text using font, color, position, font size and spacing.
::Font font
The internal raylib font to use for the text.
Text(const std::string_view text="", float fontSize=10, const ::Color &color=WHITE, const ::Font &font=::GetFontDefault(), float spacing=0)
Initializes a new Text object.
Text(const ::Font &font, const std::string_view text="", float fontSize=10, float spacing=0, const ::Color &color=WHITE)
Initializes a new Text object with a custom font.
::Color color
The color of the text.
std::string text
The internal text.
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 char *text, int posX, int posY, int fontSize, ::Color color)
Draw text (using default font)
static void DrawTextPro(const Font &font, const char *text, Vector2 position, Vector2 origin, Degree rotation, float fontSize, float spacing, ::Color tint)
Draw text using Font and pro parameters (rotation)
static void DrawTextEx(const Font &font, char *text, Vector2 position, float fontSize, float spacing, ::Color tint)
Draw text using font and additional parameters.