-
Notifications
You must be signed in to change notification settings - Fork 0
cText
Holds a string for drawing. To update the string held and have the texture update, you must run updateCText(cText*, char*).
char* str
The string stored internally. If this is modified without using updateCText(cText*, char*), this will necessarily not correspond to the text on-string.
SDL_Texture*
The SDL texture used for rendering.
cDoubleRect
The rectangle that stores where the text will be drawn and how wide and tall it is on the window.
int
Defines which layer the text is rendered on. 0 -> Not rendered. 1 -> rendered last, 2 -> rendered after 1, etc. until the last layer renderLayers -> rendered first. renderLayers is defined when running initCoSprite(), and defaults to 5.
SDL_Color
The color used for the letters and other characters.
SDL_Color
The color drawn behind the text within the borders of rect.
double
The multiplicative scaling factor for drawing the text. To resize the sprite by a certain factor, you must just modify this variable.
SDL_RendererFlip
The SDL flipping flag. SDL_FLIP_HORIZONTAL for mirroring across the y-axis, SDL_FLIP_VERTICAL for mirroring across the x-axis, and SDL_FLIP_NONE for no mirroring.
double
The rotation value of the text, in degrees clockwise from the +x axis.
bool
If true, the sprite won't be affected by the camera. It's useful in creating a HUD, or letting something important stick to the screen without camera rotation, panning, zoom, or scaling coming into play.
void initCText(cText* text, char* str, cDoubleRect rect, SDL_Color textColor, SDL_Color bgColor, double scale, SDL_RendererFlip flip, double degrees, bool fixed, int drawPriority)
Initializes a cText with the string to use, the rectangle within to draw, the text and background colors, the scaling, flipping, and rotation values, fixed flag, and draw priority.
void updateCText(cText* text, char* str)
After initializing a cText, update the string drawn to the screen with this function.
void destroyCText(cText* text)
Destroys a given cText, de-allocating all the memory associated with it. This must be done individually if the sprite is not both in a cScene and de-allocated by destroying that cScene.
void drawCText(cText text, cCamera camera, bool update)
Draws a cText to the screen given a certain camera. Pass true to update if you want the changes to be shown, or in other words, if you want the SDL_Renderer to be presented.