ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
Text.h File Reference

Text rendered with TrueType fonts. More...

#include <SDL3/SDL_gpu.h>
#include <ObjectivelyMVC/Font.h>
#include <ObjectivelyMVC/View.h>

Go to the source code of this file.

Data Structures

struct  Text
 Text rendered with TrueType fonts. More...
 

Functions

OBJECTIVELYMVC_EXPORT Class * _Text (void)
 

Variables

OBJECTIVELYMVC_EXPORT SDL_Color TextEscapeColors [10]
 Color palette for text escape sequences (^0-^7).
 

Detailed Description

Text rendered with TrueType fonts.

Definition in file Text.h.

Function Documentation

◆ _Text()

OBJECTIVELYMVC_EXPORT Class * _Text ( void  )

Definition at line 604 of file Text.c.

604 {
605 static Class *clazz;
606 static Once once;
607
608 do_once(&once, {
609 clazz = _initialize(&(const ClassDef) {
610 .name = "Text",
611 .superclass = _View(),
612 .instanceSize = sizeof(Text),
613 .interfaceOffset = offsetof(Text, interface),
614 .interfaceSize = sizeof(TextInterface),
616 });
617 });
618
619 return clazz;
620}
static void initialize(Class *clazz)
Definition Text.c:580
Class * _View(void)
Definition View.c:2056
Text rendered with TrueType fonts.
Definition Text.h:69

Variable Documentation

◆ TextEscapeColors

OBJECTIVELYMVC_EXPORT SDL_Color TextEscapeColors[10]

Color palette for text escape sequences (^0-^7).

Defines the colors used when rendering Text with colorEscapes enabled. Embedding applications can customize this array at runtime before rendering.

Default mapping:

  • ^0 = Black
  • ^1 = Red
  • ^2 = Green
  • ^3 = Yellow
  • ^4 = Blue
  • ^5 = Magenta
  • ^6 = Cyan
  • ^7 = White
Warning
Do not modify the array size (must remain exactly 8 elements).
Modifications should be made early in initialization, before rendering text.

Example customization:

TextEscapeColors[8] = (SDL_Color) { 0xFF, 0x80, 0x00, 0xFF }; // ^8 = Orange
SDL_Color TextEscapeColors[]
Definition Text.c:44

Definition at line 60 of file Text.h.