diff --git a/Makefile b/Makefile index 8cd884b..d38cbff 100755 --- a/Makefile +++ b/Makefile @@ -12,8 +12,6 @@ UNAME_P != uname -m #CC specifies which compiler we're using CC = gcc -std=c99 -MUSL = /usr/local/musl - ifeq ($(DEBUG), 1) DEFFALGS += -DDEBUG INFO = dbg @@ -78,7 +76,7 @@ COMPINCLUDE = $(edirs) $(eddirs) $(pindirs) $(bsdirs) #COMPILER_FLAGS specifies the additional compilation options we're using WARNING_FLAGS = #-Wall -Wextra -Wwrite-strings -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -Wno-incompatible-function-pointer-types -Wno-gnu-statement-expression -Wno-complex-component-init -pedantic #COMPILER_FLAGS = $(includeflag) -g -O0 $(WARNING_FLAGS) -DGLEW_STATIC -D_GLFW_X11 -D_POSIX_C_SOURCE=1993809L -c -MMD -MP $< -o $@ -COMPILER_FLAGS = $(includeflag) -I/usr/local/lib-I$MUSL/include -g -O0 $(WARNING_FLAGS) -DGLEW_STATIC -D_GLFW_X11 -D_POSIX_C_SOURCE=1993809L -c $< -o $@ +COMPILER_FLAGS = $(includeflag) -I/usr/local/include -g -O0 $(WARNING_FLAGS) -DGLEW_STATIC -D_GLFW_X11 -D_POSIX_C_SOURCE=1993809L -c $< -o $@ LIBPATH = -L./bin @@ -89,16 +87,16 @@ ifeq ($(UNAME), Windows_NT) CLIBS = glew32 EXT = .exe else - LINKER_FLAGS = - ELIBS = editor engine m - CLIBS = glfw SDL2 SDL2_mixer dl pthread + LINKER_FLAGS = -static-libgcc + ELIBS = editor engine + CLIBS = glfw SDL2 SDL2_mixer m EXT = endif ELIBS != $(call prefix, $(ELIBS), -l) CLIBS != $(call prefix, $(CLIBS), -l) -LELIBS = $(ELIBS) $(CLIBS) +LELIBS = -Wl,-Bstatic $(ELIBS) -Wl,-Bdynamic $(CLIBS) objects = $(bsobjects) $(eobjects) $(pinobjects) DEPENDS = $(objects:.o=.d) @@ -110,18 +108,18 @@ ENGINE = $(BIN)libengine.a EDITOR = $(BIN)libeditor.a INCLUDE = $(BIN)include -linkinclude = ./bin/include +linkinclude = $(BIN)include LINK = $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o $@ engine: $(yuginec:.%.c=$(objprefix)%.o) $(ENGINE) @echo Linking engine - @$(CC) $< $(linkinclude:%=-I%) $(LINK) + @$(CC) $< $(LINK) @echo Finished build editor: $(yuginec:.%.c=$(objprefix)%.o) $(EDITOR) $(ENGINE) @echo Linking editor - $(CC) $< $(linkinclude:%=-I%) $(LINK) + $(CC) $< $(LINK) @echo Finished build $(ENGINE): $(eobjects) diff --git a/source/editor/Nuklear/nuklear.h b/source/editor/Nuklear/nuklear.h index aef8f7f..73e79ba 100644 --- a/source/editor/Nuklear/nuklear.h +++ b/source/editor/Nuklear/nuklear.h @@ -6079,6 +6079,7 @@ NK_LIB void nk_property(struct nk_context *ctx, const char *name, struct nk_prop #define STB_RECT_PACK_IMPLEMENTATION #define STB_TRUETYPE_IMPLEMENTATION + /* Allow consumer to define own STBTT_malloc/STBTT_free, and use the font atlas' allocator otherwise */ #ifndef STBTT_malloc static void* @@ -15093,7 +15094,6 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info gbm.stride = gbm.w; stbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, shift_x, shift_y, ix0, iy0, 1, info->userdata); - } } STBTT_free(vertices, info->userdata); return gbm.pixels; diff --git a/source/engine/font.c b/source/engine/font.c index 3727072..0814c75 100755 --- a/source/engine/font.c +++ b/source/engine/font.c @@ -6,6 +6,8 @@ #include #include #include +#include + #include @@ -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); diff --git a/source/engine/registry.c b/source/engine/registry.c index 5627ef0..ea32a8d 100755 --- a/source/engine/registry.c +++ b/source/engine/registry.c @@ -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); +} \ No newline at end of file diff --git a/source/engine/registry.h b/source/engine/registry.h index 86fdea8..46bb2e7 100755 --- a/source/engine/registry.h +++ b/source/engine/registry.h @@ -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,