archivemuh
This commit is contained in:
74
archive/dusksdl2/display/ui/rendertext.h
Normal file
74
archive/dusksdl2/display/ui/rendertext.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* Copyright (c) 2025 Dominic Masters
|
||||
*
|
||||
* This software is released under the MIT License.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "dusksdl2.h"
|
||||
#include "ui/font.h"
|
||||
#include "display/texture/texture.h"
|
||||
|
||||
extern texture_t RENDER_TEXT_TEXTURE;
|
||||
|
||||
/**
|
||||
* Initializes the text rendering system.
|
||||
*/
|
||||
void renderTextInit(void);
|
||||
|
||||
/**
|
||||
* Draws a single character at the specified position.
|
||||
*
|
||||
* @param x The x-coordinate to draw the character at.
|
||||
* @param y The y-coordinate to draw the character at.
|
||||
* @param c The character to draw.
|
||||
* @param r The red component of the color (0-255).
|
||||
* @param g The green component of the color (0-255).
|
||||
* @param b The blue component of the color (0-255).
|
||||
*/
|
||||
void renderTextDrawChar(
|
||||
const float_t x,
|
||||
const float_t y,
|
||||
const char_t c,
|
||||
const uint8_t r,
|
||||
const uint8_t g,
|
||||
const uint8_t b
|
||||
);
|
||||
|
||||
/**
|
||||
* Draws a string of text at the specified position.
|
||||
*
|
||||
* @param x The x-coordinate to draw the text at.
|
||||
* @param y The y-coordinate to draw the text at.
|
||||
* @param text The null-terminated string of text to draw.
|
||||
* @param r The red component of the color (0-255).
|
||||
* @param g The green component of the color (0-255).
|
||||
* @param b The blue component of the color (0-255).
|
||||
*/
|
||||
void renderTextDraw(
|
||||
const float_t x,
|
||||
const float_t y,
|
||||
const char_t *text,
|
||||
const uint8_t r,
|
||||
const uint8_t g,
|
||||
const uint8_t b
|
||||
);
|
||||
|
||||
/**
|
||||
* Measures the width and height of the given text string when rendered.
|
||||
*
|
||||
* @param text The null-terminated string of text to measure.
|
||||
* @param outWidth Pointer to store the measured width in pixels.
|
||||
* @param outHeight Pointer to store the measured height in pixels.
|
||||
*/
|
||||
void renderTextMeasure(
|
||||
const char_t *text,
|
||||
int32_t *outWidth,
|
||||
int32_t *outHeight
|
||||
);
|
||||
|
||||
/**
|
||||
* Disposes of the text rendering system, freeing any allocated resources.
|
||||
*/
|
||||
void renderTextDispose(void);
|
Reference in New Issue
Block a user