diff --git a/Makefile b/Makefile index 0b6785b..cecc24f 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ BIN64_DIR=bin64 SOURCES=$(shell find $(SRC_DIR) -name "*.c" -print) SOURCES+=$(shell find "ftgl" -name "*.c" -print) OBJECTS=$(SOURCES:.c=.o) +DEPENDS=$(SOURCES:.c=.d) TARGET32=$(BIN32_DIR)/liboverlay.so TARGET64=$(BIN64_DIR)/liboverlay.so @@ -56,6 +57,9 @@ ftgl/makefont.o : CFLAGS+=-w .c.o: $(CC) $(CFLAGS) -c $< -o $@ +.c.d: + @$(CC) -M $(CXXFLAGS) $< > $@ + $(TARGET): $(OBJECTS) $(CC) $(LDFLAGS) $(OBJECTS) $(LDLIBS) -o $@ @@ -64,5 +68,10 @@ clean_objects: clean: find . -type f -name '*.o' -delete + find . -type f -name '*.d' -delete rm -f bin32/*.so - rm -f bin64/*.so \ No newline at end of file + rm -f bin64/*.so + +ifneq ($(MAKECMDGOALS), clean) +-include $(DEPENDS) +endif \ No newline at end of file diff --git a/bin32/liboverlay.so b/bin32/liboverlay.so index ca151a1..c3304f9 100755 Binary files a/bin32/liboverlay.so and b/bin32/liboverlay.so differ diff --git a/bin64/liboverlay.so b/bin64/liboverlay.so index 86b9874..7e86e5e 100755 Binary files a/bin64/liboverlay.so and b/bin64/liboverlay.so differ diff --git a/src/drawglx.c b/src/drawglx.c index 1f90654..7937867 100644 --- a/src/drawglx.c +++ b/src/drawglx.c @@ -378,7 +378,7 @@ void draw_string_internal(float x, float y, const char *string, texture_font_t *fnt, vec4 color, float *out_x, float *out_y) { float pen_x = x; - float pen_y = y; + float pen_y = y + fnt->height / 1.5f; float size_y = 0; //texture_font_load_glyphs(fnt, string); @@ -389,10 +389,10 @@ draw_string_internal(float x, float y, const char *string, texture_font_t *fnt, } ds_bind_texture(fnt->atlas->id); if (fnt->atlas->dirty) { - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, fnt->atlas->width, fnt->atlas->height, 0, GL_RED, GL_UNSIGNED_BYTE, fnt->atlas->data); fnt->atlas->dirty = 0; } @@ -406,7 +406,7 @@ draw_string_internal(float x, float y, const char *string, texture_font_t *fnt, texture_glyph_t *glyph = texture_font_find_glyph(fnt, &string[i]); if (glyph == NULL) { - texture_font_load_glyph(fnt, &string[i - 1]); + texture_font_load_glyph(fnt, &string[i]); continue; } GLuint indices[6]; @@ -438,6 +438,7 @@ draw_string_internal(float x, float y, const char *string, texture_font_t *fnt, vertices[3] = (struct vertex_main){ (vec2){ x1, y0 }, (vec2){ s1, t0 }, color, DRAW_MODE_FREETYPE }; pen_x += glyph->advance_x; + pen_x = (int)pen_x + 1; if (glyph->height > size_y) size_y = glyph->height; diff --git a/src/fontapi.c b/src/fontapi.c index b759735..43b223d 100644 --- a/src/fontapi.c +++ b/src/fontapi.c @@ -42,12 +42,15 @@ xoverlay_font_load(const char *path, float size) if (result.font == NULL) { log_write("fontapi: load: could not init font\n"); + return XOVERLAY_FONT_INVALID_HANDLE; } } else { log_write("fontapi: load: could not init atlas\n"); + return XOVERLAY_FONT_INVALID_HANDLE; } + result.font->hinting = 0; return fontapi_add_font(&result); } diff --git a/src/program.c b/src/program.c index 80b89f3..683c718 100644 --- a/src/program.c +++ b/src/program.c @@ -67,9 +67,10 @@ const char *shader_ultimate_frag = " if (frag_DrawMode == 2)\n" " gl_FragColor = frag_Color * tex;\n" " else if (frag_DrawMode == 3)\n" - " if (tex.r < 0.5) gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);\n" - " else\n" - " gl_FragColor = vec4(frag_Color.rgb, frag_Color.a * tex.r);\n" + " {\n" + " if (tex.r > 0.4) tex.r = 1.0;\n" + " gl_FragColor = vec4(frag_Color.rgb, frag_Color.a * tex.r);\n" + " }\n" " else\n" " gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);\n" " }\n"