Nox Engine
 
Loading...
Searching...
No Matches
Points Struct Reference

A Text component that displays a score or point value. More...

#include <Counters.h>

Inheritance diagram for Points:
Inheritance graph
Collaboration diagram for Points:
Collaboration graph

Public Member Functions

 Points (std::string inStr)
 Constructs a Points counter.
 
void update () override
 Updates the displayed text if the point value has changed.
 
void reload () override
 Resets the points value to its initial state.
 
 Text (std::string inStr, int x, int y, float scale, SDL_Color color)
 Constructs a fully customized Text component.
 
 Text (std::string inStr, int x, int y, float scale)
 Constructs a Text component with a default color.
 
 Text (std::string inStr, int x, int y)
 Constructs a Text component with a default color and scale.
 
- Public Member Functions inherited from Text
 Text (std::string inStr, int x, int y, float scale, SDL_Color color)
 Constructs a fully customized Text component.
 
 Text (std::string inStr, int x, int y, float scale)
 Constructs a Text component with a default color.
 
 Text (std::string inStr, int x, int y)
 Constructs a Text component with a default color and scale.
 
void update () override
 Updates the destination rectangle for rendering.
 
void draw () override
 Draws the text texture to the screen.
 
void changeText (std::string text)
 Changes the text content and regenerates the texture.
 
void centreText (SDL_Rect &parentRect)
 Adjusts the text's position to be centered within a parent rectangle.
 
- Public Member Functions inherited from Component
virtual void init ()
 Called once when the component is added to an entity.
 

Public Attributes

int value
 The numerical score value.
 
- Public Attributes inherited from Component
Entityentity
 Pointer to the entity that owns this component.
 

Additional Inherited Members

- Protected Member Functions inherited from Text
void setTex (const char *text)
 Creates a new texture from a string of text.
 
- Protected Attributes inherited from Text
std::string data
 
float scale
 
SDL_TexturetextTex
 
SDL_Colour textColour
 
SDL_Rect destRect
 

Detailed Description

A Text component that displays a score or point value.

Constructor & Destructor Documentation

◆ Points()

Points::Points ( std::string  inStr)

Constructs a Points counter.

Parameters
inStrThe prefix string to display (e.g., "Score: ").
Here is the call graph for this function:

Member Function Documentation

◆ reload()

void Points::reload ( )
overridevirtual

Resets the points value to its initial state.

Reimplemented from Component.

◆ Text() [1/3]

Text::Text ( std::string  inStr,
int  x,
int  y 
)

Constructs a Text component with a default color and scale.

Parameters
inStrThe initial string to display.
xThe x-position.
yThe y-position.

◆ Text() [2/3]

Text::Text ( std::string  inStr,
int  x,
int  y,
float  scale 
)

Constructs a Text component with a default color.

Parameters
inStrThe initial string to display.
xThe x-position.
yThe y-position.
scaleThe rendering scale.

◆ Text() [3/3]

Text::Text ( std::string  inStr,
int  x,
int  y,
float  scale,
SDL_Color  color 
)

Constructs a fully customized Text component.

Parameters
inStrThe initial string to display.
xThe x-position.
yThe y-position.
scaleThe rendering scale.
colorThe color of the text.

◆ update()

void Points::update ( )
overridevirtual

Updates the displayed text if the point value has changed.

Reimplemented from Component.

Here is the call graph for this function:

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