Added True Type fonts
This commit is contained in:
@ -7,10 +7,6 @@
|
||||
|
||||
#include "asset.h"
|
||||
|
||||
// Due to some bullshit, this is here.
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include <stb_image.h>
|
||||
|
||||
char * assetStringLoad(char *assetName) {
|
||||
// Open a buffer.
|
||||
FILE *fptr = assetBufferOpen(assetName);
|
||||
@ -121,4 +117,10 @@ void assetTextureLoad(texture_t *texture, char *fileName) {
|
||||
// Turn into a texture.
|
||||
textureInit(texture, width, height, data);
|
||||
stbi_image_free(data);
|
||||
}
|
||||
|
||||
void assetFontLoad(font_t *font, char *assetName, float size) {
|
||||
char *data = assetStringLoad(assetName);
|
||||
fontInit(font, data, size);
|
||||
free(data);
|
||||
}
|
@ -9,6 +9,7 @@
|
||||
#include <dawn/dawn.h>
|
||||
#include "../display/shader.h"
|
||||
#include "../display/texture.h"
|
||||
#include "../display/gui/font.h"
|
||||
|
||||
/**
|
||||
* Method to load an asset into memory as a raw string.
|
||||
@ -67,4 +68,12 @@ void assetShaderLoad(shader_t *shader, char *fileVertex, char *fileFragment);
|
||||
* @param texture Texture to load the file into.
|
||||
* @param fileName The file path of the PNG image.
|
||||
*/
|
||||
void assetTextureLoad(texture_t *texture, char *fileName);
|
||||
void assetTextureLoad(texture_t *texture, char *fileName);
|
||||
|
||||
/**
|
||||
* Load a font from a TTF file.
|
||||
* @param font Font to load into.
|
||||
* @param assetName Asset name for the TTF font.
|
||||
* @param size Size of the font.
|
||||
*/
|
||||
void assetFontLoad(font_t *font, char *assetName, float size);
|
Reference in New Issue
Block a user