Dawn/src/ui/label.h
2021-11-25 08:31:35 -08:00

51 lines
1.1 KiB
C

// Copyright (c) 2021 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#pragma once
#include "../libs.h"
#include "../display/shader.h"
#include "../display/primitive/primitive.h"
#include "../display/font.h"
/** Representation of a Label UI Element */
typedef struct {
font_t *font;
float fontSize;
float maxWidth;
fonttextinfo_t info;
primitive_t primitive;
} label_t;
/**
* Initialize a Label UI Element.
* @param label Label to initialize.
*/
void labelInit(label_t *label);
/**
* Sets the text for a given label.
*
* @param label Label to update.
* @param font Font to use.
* @param text Text to set.
*/
void labelSetText(label_t *label, font_t *font, char *text);
/**
* Render a label UI element.
*
* @param label Label to render.
* @param shader Shader to use while rendering.
* @param x X position.
* @param y Y position.
*/
void labelRender(label_t *label, shader_t *shader, float x, float y);
/**
* Dispose a previously created label.
*
* @param label Label to dispose.
*/
void labelDispose(label_t *label);