sdl2dll
Loading...
Searching...
No Matches
sdl::Font Class Reference

Clase para encapsular una fuente de caracteres SDL. More...

#include <sdl_font.h>

Public Member Functions

EXPORT Font (Renderer &render, const std::string &fontfile, int ptsize=17)
 Constructor.
 
EXPORT ~Font ()
 Destructor.
 
EXPORT void SetStyle (int style)
 Establece el estilo de la fuente.
 
EXPORT void SetSize (int ptsize)
 Establece el tamaño de la fuente.
 
EXPORT void SetOutline (int outline)
 Establece el contorno actual de una fuente.
 
EXPORT void SetDirection (TTF_Direction direction)
 Establece la dirección que se utilizará para dar forma al texto.
 
EXPORT void SetHinting (int hinting)
 Establece la configuración del interior actual.
 
EXPORT Rect GetArea (const std::string &text)
 Obtiene el área rectangular necesaria para mostrar el texto indicado.
 
EXPORT void RenderUTF8_Blended (const std::string &text, int x, int y, Color fg)
 Muestra un texto en pantalla.
 
EXPORT void RenderUTF8_Blended (const std::string &text, Point &p, Color fg)
 Muestra un texto en pantalla.
 

Protected Attributes

TTF_Font * font
 
Rendererrenderer
 

Detailed Description

Clase para encapsular una fuente de caracteres SDL.

Constructor & Destructor Documentation

◆ Font()

EXPORT sdl::Font::Font ( Renderer & render,
const std::string & fontfile,
int ptsize = 17 )
inline

Constructor.

Parameters
renderRenderer& Contexto de renderizado necesario para mostrar texto en pantalla
fontfilestring& Nombre del fichero que contiene la fuente
ptsizeint Tamaño de la fuente

◆ ~Font()

EXPORT sdl::Font::~Font ( )
inline

Destructor.

Libera la memoria usada por la fuente

Member Function Documentation

◆ GetArea()

EXPORT Rect sdl::Font::GetArea ( const std::string & text)

Obtiene el área rectangular necesaria para mostrar el texto indicado.

Parameters
textstring& texto para el que se calcula el área
Returns
Rect objeto con las dimensiones del área

◆ RenderUTF8_Blended() [1/2]

EXPORT void sdl::Font::RenderUTF8_Blended ( const std::string & text,
int x,
int y,
Color fg )

Muestra un texto en pantalla.

Parameters
textstring& texto a mostrar
xint coordenada x
yint coordenada y
fgColor color utilizado para el texto

◆ RenderUTF8_Blended() [2/2]

EXPORT void sdl::Font::RenderUTF8_Blended ( const std::string & text,
Point & p,
Color fg )
inline

Muestra un texto en pantalla.

Parameters
textstring& texto a mostrar
pPoint& coordenadas
fgColor color utilizado para el texto

◆ SetDirection()

EXPORT void sdl::Font::SetDirection ( TTF_Direction direction)
inline

Establece la dirección que se utilizará para dar forma al texto.

Parameters
directionTTF_Direction Uno de los valores TTF_Direction para la nueva dirección para el texto: TTF_DIRECTION_LTR (De izquierda a derecha). TTF_DIRECTION_RTL (De derecha a izquierda). TTF_DIRECTION_TTB (De arriba a abajo). TTF_DIRECTION_BTT (de abajo arriba).

◆ SetHinting()

EXPORT void sdl::Font::SetHinting ( int hinting)
inline

Establece la configuración del interior actual.

Parameters
hintingint El ajuste de interior es un valor único: TTF_HINTING_NORMAL TTF_HINTING_LIGHT TTF_HINTING_MONO TTF_HINTING_NONE TTF_HINTING_LIGHT_SUBPIXEL (disponible en SDL_ttf 2.0.18 y posteriores)

◆ SetOutline()

EXPORT void sdl::Font::SetOutline ( int outline)
inline

Establece el contorno actual de una fuente.

Parameters
outlineint un valor de contorno positivo

◆ SetSize()

EXPORT void sdl::Font::SetSize ( int ptsize)
inline

Establece el tamaño de la fuente.

Parameters
ptsizeint nuevo tamaño de la fuente

◆ SetStyle()

EXPORT void sdl::Font::SetStyle ( int style)
inline

Establece el estilo de la fuente.

Permite establecer uno o varios estilos combinados con OR entre los disponibles: TTF_STYLE_NORMAL, TTF_STYLE_BOLD, TTF_STYLE_ITALIC, TTF_STYLE_UNDERLINE y TTF_STYLE_STRIKETHROUGH

Parameters
styleint nuevo estilo para aplicar a la fuente

Member Data Documentation

◆ font

TTF_Font* sdl::Font::font
protected

Estructura encapsulada

◆ renderer

Renderer& sdl::Font::renderer
protected

Contexto de renderizado para mostrar texto


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