text drawing using freetype

This commit is contained in:
2023-09-12 03:21:54 +02:00
parent 6f70018892
commit 41d28a222c
18 changed files with 697 additions and 50 deletions
+21
View File
@@ -0,0 +1,21 @@
#pragma once
#include "shader.h"
typedef struct Size {
int width;
int height;
} Size;
typedef struct Character {
unsigned int texture_id;
Size size;
Size bearing;
unsigned int advance;
} Character;
int init_fonts(const char *font_path);
void prepare_font(unsigned int *vao, unsigned int *vbo);
Size calculate_text_size(const char *text, float scale);
void draw_number(Shader shader, int text, int row, int column, float scale,unsigned int vao, unsigned int vbo, float* transform);
void draw_text(Shader shader, const char *text, Size text_size, float scale, unsigned int vao, unsigned int vbo, float *projection);