Reworking everything about shaders.
This commit is contained in:
51
src/display/ui/label.h
Normal file
51
src/display/ui/label.h
Normal file
@ -0,0 +1,51 @@
|
||||
// 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/shaderprogram.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, shaderprogram_t *shader, float x, float y);
|
||||
|
||||
/**
|
||||
* Dispose a previously created label.
|
||||
*
|
||||
* @param label Label to dispose.
|
||||
*/
|
||||
void labelDispose(label_t *label);
|
Reference in New Issue
Block a user