very good
This commit is contained in:
parent
350bef500a
commit
523296bb46
9
Makefile
9
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
|
||||
|
||||
ifneq ($(MAKECMDGOALS), clean)
|
||||
-include $(DEPENDS)
|
||||
endif
|
Binary file not shown.
Binary file not shown.
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user