This commit is contained in:
2022-06-21 20:21:00 +00:00
parent 162aebe3fa
commit b5de1012ff
5 changed files with 33 additions and 13 deletions

View File

@@ -6,6 +6,8 @@
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include <stdlib.h>
#include <stb_truetype.h>
@@ -13,7 +15,7 @@
static uint32_t VBO = 0;
static uint32_t VAO = 0;
unsigned char ttf_buffer[24 << 20];
unsigned char ttf_buffer[1<<25];
unsigned char temp_bitmap[512 * 512];
struct sFont *font;
@@ -34,7 +36,10 @@ struct sFont *MakeFont(const char *fontfile, int height)
stbtt_fontinfo fontinfo = { 0 };
int ascent = 0;
stbtt_InitFont(&fontinfo, ttf_buffer, 0);
fread(ttf_buffer, 1, 1<<25, fopen(fontpath, "rb"));
stbtt_InitFont(&fontinfo, ttf_buffer, stbtt_GetFontOffsetForIndex(ttf_buffer,0));
stbtt_GetFontVMetrics(&fontinfo, &ascent, 0, 0);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);

View File

@@ -53,3 +53,15 @@ void register_component(const char *name, size_t size,
c->id = ncomponent - 1;
c->datasize = size;
}
void comp_draw_debug(struct component *c) {
c->draw_debug(c->data);
}
void comp_draw_gui(struct component *c) {
c->draw_gui(c->data);
}
void comp_update(struct component *c, struct mGameObject *go) {
c->update(c->data, go);
}

View File

@@ -22,6 +22,11 @@ struct component {
extern struct component components[MAXNAME];
extern int ncomponent;
void comp_draw_debug(struct component *c);
void comp_draw_gui(struct component *c);
void comp_update(struct component *c, struct mGameObject *go);
void registry_init();
void register_component(const char *name, size_t size,
void (*make)(struct mGameObject * go,