Update
This commit is contained in:
parent
162aebe3fa
commit
b5de1012ff
18
Makefile
18
Makefile
|
@ -12,8 +12,6 @@ UNAME_P != uname -m
|
||||||
#CC specifies which compiler we're using
|
#CC specifies which compiler we're using
|
||||||
CC = gcc -std=c99
|
CC = gcc -std=c99
|
||||||
|
|
||||||
MUSL = /usr/local/musl
|
|
||||||
|
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
DEFFALGS += -DDEBUG
|
DEFFALGS += -DDEBUG
|
||||||
INFO = dbg
|
INFO = dbg
|
||||||
|
@ -78,7 +76,7 @@ COMPINCLUDE = $(edirs) $(eddirs) $(pindirs) $(bsdirs)
|
||||||
#COMPILER_FLAGS specifies the additional compilation options we're using
|
#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
|
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) -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
|
LIBPATH = -L./bin
|
||||||
|
|
||||||
|
@ -89,16 +87,16 @@ ifeq ($(UNAME), Windows_NT)
|
||||||
CLIBS = glew32
|
CLIBS = glew32
|
||||||
EXT = .exe
|
EXT = .exe
|
||||||
else
|
else
|
||||||
LINKER_FLAGS =
|
LINKER_FLAGS = -static-libgcc
|
||||||
ELIBS = editor engine m
|
ELIBS = editor engine
|
||||||
CLIBS = glfw SDL2 SDL2_mixer dl pthread
|
CLIBS = glfw SDL2 SDL2_mixer m
|
||||||
EXT =
|
EXT =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ELIBS != $(call prefix, $(ELIBS), -l)
|
ELIBS != $(call prefix, $(ELIBS), -l)
|
||||||
CLIBS != $(call prefix, $(CLIBS), -l)
|
CLIBS != $(call prefix, $(CLIBS), -l)
|
||||||
|
|
||||||
LELIBS = $(ELIBS) $(CLIBS)
|
LELIBS = -Wl,-Bstatic $(ELIBS) -Wl,-Bdynamic $(CLIBS)
|
||||||
|
|
||||||
objects = $(bsobjects) $(eobjects) $(pinobjects)
|
objects = $(bsobjects) $(eobjects) $(pinobjects)
|
||||||
DEPENDS = $(objects:.o=.d)
|
DEPENDS = $(objects:.o=.d)
|
||||||
|
@ -110,18 +108,18 @@ ENGINE = $(BIN)libengine.a
|
||||||
EDITOR = $(BIN)libeditor.a
|
EDITOR = $(BIN)libeditor.a
|
||||||
INCLUDE = $(BIN)include
|
INCLUDE = $(BIN)include
|
||||||
|
|
||||||
linkinclude = ./bin/include
|
linkinclude = $(BIN)include
|
||||||
|
|
||||||
LINK = $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o $@
|
LINK = $(LIBPATH) $(LINKER_FLAGS) $(LELIBS) -o $@
|
||||||
|
|
||||||
engine: $(yuginec:.%.c=$(objprefix)%.o) $(ENGINE)
|
engine: $(yuginec:.%.c=$(objprefix)%.o) $(ENGINE)
|
||||||
@echo Linking engine
|
@echo Linking engine
|
||||||
@$(CC) $< $(linkinclude:%=-I%) $(LINK)
|
@$(CC) $< $(LINK)
|
||||||
@echo Finished build
|
@echo Finished build
|
||||||
|
|
||||||
editor: $(yuginec:.%.c=$(objprefix)%.o) $(EDITOR) $(ENGINE)
|
editor: $(yuginec:.%.c=$(objprefix)%.o) $(EDITOR) $(ENGINE)
|
||||||
@echo Linking editor
|
@echo Linking editor
|
||||||
$(CC) $< $(linkinclude:%=-I%) $(LINK)
|
$(CC) $< $(LINK)
|
||||||
@echo Finished build
|
@echo Finished build
|
||||||
|
|
||||||
$(ENGINE): $(eobjects)
|
$(ENGINE): $(eobjects)
|
||||||
|
|
|
@ -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_RECT_PACK_IMPLEMENTATION
|
||||||
#define STB_TRUETYPE_IMPLEMENTATION
|
#define STB_TRUETYPE_IMPLEMENTATION
|
||||||
|
|
||||||
|
|
||||||
/* Allow consumer to define own STBTT_malloc/STBTT_free, and use the font atlas' allocator otherwise */
|
/* Allow consumer to define own STBTT_malloc/STBTT_free, and use the font atlas' allocator otherwise */
|
||||||
#ifndef STBTT_malloc
|
#ifndef STBTT_malloc
|
||||||
static void*
|
static void*
|
||||||
|
@ -15094,7 +15095,6 @@ STBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info
|
||||||
|
|
||||||
stbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, shift_x, shift_y, ix0, iy0, 1, info->userdata);
|
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);
|
STBTT_free(vertices, info->userdata);
|
||||||
return gbm.pixels;
|
return gbm.pixels;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <stb_truetype.h>
|
#include <stb_truetype.h>
|
||||||
|
@ -13,7 +15,7 @@
|
||||||
static uint32_t VBO = 0;
|
static uint32_t VBO = 0;
|
||||||
static uint32_t VAO = 0;
|
static uint32_t VAO = 0;
|
||||||
|
|
||||||
unsigned char ttf_buffer[24 << 20];
|
unsigned char ttf_buffer[1<<25];
|
||||||
unsigned char temp_bitmap[512 * 512];
|
unsigned char temp_bitmap[512 * 512];
|
||||||
|
|
||||||
struct sFont *font;
|
struct sFont *font;
|
||||||
|
@ -34,7 +36,10 @@ struct sFont *MakeFont(const char *fontfile, int height)
|
||||||
stbtt_fontinfo fontinfo = { 0 };
|
stbtt_fontinfo fontinfo = { 0 };
|
||||||
int ascent = 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);
|
stbtt_GetFontVMetrics(&fontinfo, &ascent, 0, 0);
|
||||||
|
|
||||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
|
|
@ -53,3 +53,15 @@ void register_component(const char *name, size_t size,
|
||||||
c->id = ncomponent - 1;
|
c->id = ncomponent - 1;
|
||||||
c->datasize = size;
|
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);
|
||||||
|
}
|
|
@ -22,6 +22,11 @@ struct component {
|
||||||
extern struct component components[MAXNAME];
|
extern struct component components[MAXNAME];
|
||||||
extern int ncomponent;
|
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 registry_init();
|
||||||
void register_component(const char *name, size_t size,
|
void register_component(const char *name, size_t size,
|
||||||
void (*make)(struct mGameObject * go,
|
void (*make)(struct mGameObject * go,
|
||||||
|
|
Loading…
Reference in a new issue