Mario Kart 64
Loading...
Searching...
No Matches
AText Class Reference

#include <Text.h>

Inheritance diagram for AText:
[legend]
Collaboration diagram for AText:
[legend]

Data Structures

struct  CharacterList
 

Public Types

enum  TextMode : int16_t { STATIONARY , FOLLOW_PLAYER }
 
enum  FadeMode : int16_t { NO_FADE , FADE_IN , FADE_OUT }
 
enum  DistanceProps : int16_t { TOO_CLOSE , ACTIVE , TOO_FAR }
 

Public Member Functions

 AText (const SpawnParams &params)
 
virtual ~AText () override=default
 
virtual void Tick () override
 
virtual void Draw (Camera *camera) override
 
virtual void SetSpawnParams (SpawnParams &params) override
 
virtual bool IsMod () override
 
virtual void DrawEditorProperties () override
 
void DrawColourEditor (bool *updated)
 
void FollowPlayer ()
 
void SetText (std::string text)
 
std::string ValidateString (const std::string_view &text)
 
void Refresh ()
 
void Print3D (char *text, s32 tracking, s32 mode)
 
void PrintLetter3D (MenuTexture *glyphTexture, f32 column, f32 row, s32 mode)
 
void SetupVtx ()
 
void DrawText3D (Camera *camera)
 
void AnimateColour (Vtx *vtx)
 
void FadeIn (Vtx *vtx)
 
void FadeOut (Vtx *vtx)
 
uint8_t FloatToU8 (float v)
 
- Public Member Functions inherited from AActor
virtual ~AActor ()=default
 
 AActor ()
 
 AActor (SpawnParams params)
 
virtual void BeginPlay ()
 
virtual void Collision (Player *player, AActor *actor)
 
virtual void VehicleCollision (s32 playerId, Player *player)
 
void SetLocation (FVector pos)
 
virtual void Destroy ()
 
FVector GetLocation () const
 
IRotator GetRotation () const
 
FVector GetScale () const
 
void Translate (FVector pos)
 
void Rotate (IRotator rot)
 
void SetScale (FVector scale)
 

Static Public Member Functions

static ATextSpawn (std::string text, FVector pos, FVector scale, AText::TextMode textMode, int16_t playerIndex)
 

Data Fields

DistanceProps Dist = ACTIVE
 
DistanceProps PrevState = ACTIVE
 
FadeMode FadeState = NO_FADE
 
std::vector< CharacterListTextureList
 
std::string Text
 
TextMode Mode
 
uint32_t PlayerIndex
 
float WidthOffset = 0.0f
 
float HeightOffset = 8.0f
 
f32 ScaleX = 1.0f
 
f32 LetterSpacing = 1.0f
 
f32 Far = 14000.0f
 
f32 Close = 350.0f
 
bool FaceCamera = true
 
bool Animate = false
 
bool SingleColour = true
 
RGBA8 TextColour [4]
 
Vtx myVtx [12]
 
- Data Fields inherited from AActor
s16 Type = 0
 
s16 Flags
 
s16 Unk_04
 
s16 State
 
f32 Unk_08
 
f32 BoundingBoxSize
 
Vec3s Rot = {0, 0, 0}
 
s16 Unk_16
 
Vec3f Pos
 
Vec3f Velocity = {0, 0, 0}
 
Collision Unk30
 
const char * Model = ""
 
uint8_t uuid [16]
 
const char * Name = ""
 
const char * ResourceName = ""
 
FVector SpawnPos = {0.0f, 0.0f, 0.0f}
 
IRotator SpawnRot = {0, 0, 0}
 
FVector SpawnScale = {1.0f, 1.0f, 1.0f}
 
FVector Scale = {1, 1, 1}
 
float Speed = 0.0f
 
std::vector< TriangleTriangles
 
bool bPendingDestroy = false
 

Member Enumeration Documentation

◆ DistanceProps

enum AText::DistanceProps : int16_t
Enumerator
TOO_CLOSE 
ACTIVE 
TOO_FAR 

◆ FadeMode

enum AText::FadeMode : int16_t
Enumerator
NO_FADE 
FADE_IN 
FADE_OUT 

◆ TextMode

enum AText::TextMode : int16_t
Enumerator
STATIONARY 
FOLLOW_PLAYER 

Constructor & Destructor Documentation

◆ AText()

AText::AText ( const SpawnParams & params)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~AText()

virtual AText::~AText ( )
overridevirtualdefault

Member Function Documentation

◆ AnimateColour()

void AText::AnimateColour ( Vtx * vtx)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Draw()

void AText::Draw ( Camera * camera)
overridevirtual

Reimplemented from AActor.

Here is the call graph for this function:

◆ DrawColourEditor()

void AText::DrawColourEditor ( bool * updated)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ DrawEditorProperties()

void AText::DrawEditorProperties ( )
overridevirtual

Reimplemented from AActor.

Here is the call graph for this function:

◆ DrawText3D()

void AText::DrawText3D ( Camera * camera)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ FadeIn()

void AText::FadeIn ( Vtx * vtx)
Here is the caller graph for this function:

◆ FadeOut()

void AText::FadeOut ( Vtx * vtx)
Here is the caller graph for this function:

◆ FloatToU8()

uint8_t AText::FloatToU8 ( float v)
inline
Here is the caller graph for this function:

◆ FollowPlayer()

void AText::FollowPlayer ( )
Here is the caller graph for this function:

◆ IsMod()

bool AText::IsMod ( )
overridevirtual

Reimplemented from AActor.

◆ Print3D()

void AText::Print3D ( char * text,
s32 tracking,
s32 mode )

These have been refactored for efficiency purposes. The new method uses 1 matrix to display the whole string And then setting vertex data is done during the setup/constructor phase, instead of during rendering This requires a refresh if the data ever changes

This method is more efficient because the original version does all this work during the render phase. Now it's done during the actor spawn phase with the exception if any changes are made at runtime.

FAKE:

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PrintLetter3D()

void AText::PrintLetter3D ( MenuTexture * glyphTexture,
f32 column,
f32 row,
s32 mode )
Here is the caller graph for this function:

◆ Refresh()

void AText::Refresh ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetSpawnParams()

void AText::SetSpawnParams ( SpawnParams & params)
overridevirtual

Make sure you call this in derived classes! Usage: MyActor::SetSpawnParams(SetSpawnParams& params) { AActor::SetSpawnParams(params); // Calls default implementation }

Reimplemented from AActor.

Here is the call graph for this function:

◆ SetText()

void AText::SetText ( std::string text)
Here is the call graph for this function:

◆ SetupVtx()

void AText::SetupVtx ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Spawn()

static AText * AText::Spawn ( std::string text,
FVector pos,
FVector scale,
AText::TextMode textMode,
int16_t playerIndex )
inlinestatic

This is simply a helper function to keep Spawning code clean Main parameters usage:

PlayerIndex is only used if textMode is FOLLOW_PLAYER

Other available options:

TextColour<RGBA8> - Colour of the text (1 colour for each vertex) ScaleX<float> - Font scale Y LetterSpacing<float> - Space between letters HeightOffset<float> - Height above player when in FOLLOW_PLAYER mode WidthOffset<float> - Left/right offset of the text when in FOLLOW_PLAYER mode Far<float> - Skip rendering if camera is too far away Close<float> - Skip rendering if too close to the camera Animate<bool> - Cycle colours similar to the grand prix title text

Other options usage:

AText* text = AText::Spawn("Hello World", FVector(0, 0, 0), etc.); text->Animate = true; text->Far = 14000.0f; text->ScaleX = 0.1f; // Recommend in the range of 0-2.0f. Default 1.0f text->LetterSpacing = 1.0f; // Default 1.0f

For one single colour, set all vertices to the same colour. text->TextColour[0] = {255, 0, 0, 255}; // Red text->TextColour[1] = {0, 255, 0, 255}; // Green text->TextColour[2] = {0, 0, 255, 255}; // Blue text->TextColour[3] = {255, 255, 0, 255}; // Yellow

The above will result in a gradient between red, green, blue, and yellow For transparency {0, 0, 0, 100} <– alpha value of 100 will render semi-transparent black text.

Here is the call graph for this function:

◆ Tick()

void AText::Tick ( )
overridevirtual

Reimplemented from AActor.

Here is the call graph for this function:

◆ ValidateString()

std::string AText::ValidateString ( const std::string_view & s)

Filters out bad characters (allows a-z, A-Z, 0-9, space) Returns "Blank Text" for blank input Returns "Invalid" if no valid input found Limits str to 20 characters

The font does support some symbols and other language characters But these need to be checked thoroughly before white-listing.

Here is the caller graph for this function:

Field Documentation

◆ Animate

bool AText::Animate = false

◆ Close

f32 AText::Close = 350.0f

◆ Dist

DistanceProps AText::Dist = ACTIVE

◆ FaceCamera

bool AText::FaceCamera = true

◆ FadeState

FadeMode AText::FadeState = NO_FADE

◆ Far

f32 AText::Far = 14000.0f

◆ HeightOffset

float AText::HeightOffset = 8.0f

◆ LetterSpacing

f32 AText::LetterSpacing = 1.0f

◆ Mode

TextMode AText::Mode

◆ myVtx

Vtx AText::myVtx[12]
Initial value:
= {
{{{ 0, 16, 0}, 0, { 0, 0}, {0xff, 0xff, 0xff, 0xff}}},
{{{26, 16, 0}, 0, {1600, 0}, {0xff, 0xff, 0xff, 0xff}}},
{{{26, 0, 0}, 0, {1600, 960}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 0, 0, 0}, 0, { 0, 960}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 0, 16, 0}, 0, { 0, 0}, {0xff, 0xff, 0xff, 0xff}}},
{{{16, 16, 0}, 0, {960, 0}, {0xff, 0xff, 0xff, 0xff}}},
{{{16, 0, 0}, 0, {960, 960}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 0, 0, 0}, 0, { 0, 960}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 0, 32, 0}, 0, { 0, 0}, {0xff, 0xff, 0xff, 0xff}}},
{{{30, 32, 0}, 0, {1856, 0}, {0xff, 0xff, 0xff, 0xff}}},
{{{30, 0, 0}, 0, {1856, 1984}, {0xff, 0xff, 0xff, 0xff}}},
{{{ 0, 0, 0}, 0, { 0, 1984}, {0xff, 0xff, 0xff, 0xff}}},
}

◆ PlayerIndex

uint32_t AText::PlayerIndex

◆ PrevState

DistanceProps AText::PrevState = ACTIVE

◆ ScaleX

f32 AText::ScaleX = 1.0f

◆ SingleColour

bool AText::SingleColour = true

◆ Text

std::string AText::Text

◆ TextColour

RGBA8 AText::TextColour[4]

◆ TextureList

std::vector<CharacterList> AText::TextureList

◆ WidthOffset

float AText::WidthOffset = 0.0f

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