43 lines
891 B
C
43 lines
891 B
C
#ifndef LEDDA_TEXTURE_H
|
|
#define LEDDA_TEXTURE_H
|
|
|
|
#include "../core.h"
|
|
#include "../vendor/loaders/stb_truetype.h"
|
|
#include "../vendor/loaders/stb_image.h"
|
|
#include "../vendor/glad/glad.h"
|
|
|
|
typedef struct Texture Texture;
|
|
struct Texture {
|
|
uint32 tex_id;
|
|
int32 width;
|
|
int32 height;
|
|
};
|
|
|
|
typedef struct GlyphMeta GlyphMeta;
|
|
struct GlyphMeta {
|
|
Vec2 uv0;
|
|
Vec2 uv1;
|
|
real32 xOffset;
|
|
real32 yOffset;
|
|
real32 width;
|
|
real32 height;
|
|
};
|
|
|
|
DefineList(GlyphMeta, GlyphMeta);
|
|
|
|
typedef struct Font Font;
|
|
struct Font {
|
|
GlyphMetaList glyphMeta;
|
|
real32 lineHeight;
|
|
real32 charWidth;
|
|
uint32 texId;
|
|
uint32 glyphTableTexId;
|
|
uint32 glyphTableBufId;
|
|
};
|
|
|
|
Texture createTexture(const char* bitmap, int32 width, int32 height);
|
|
Texture createTextureFromFile(const char* source_path);
|
|
Font createFont(Arena *arena, string ttfLocation, real32 lineHeight);
|
|
|
|
#endif
|