Fix y coordinate orientation in font rendering call
This commit is contained in:
parent
31d7cb5ce0
commit
4a8df09829
|
@ -21,6 +21,6 @@ int FontRendererDrawText(FontRenderer *fr_, RenColor *pixels, int width, int hei
|
||||||
font_renderer_lcd *font_renderer = (font_renderer_lcd *) fr_;
|
font_renderer_lcd *font_renderer = (font_renderer_lcd *) fr_;
|
||||||
agg::rendering_buffer ren_buf((agg::int8u *) pixels, width, height, -pitch);
|
agg::rendering_buffer ren_buf((agg::int8u *) pixels, width, height, -pitch);
|
||||||
const agg::rgba8 agg_color(color.r, color.g, color.b);
|
const agg::rgba8 agg_color(color.r, color.g, color.b);
|
||||||
double new_x = font_renderer->render_text(ren_buf, (double) text_size, agg_color, (double) x, (double) y, text);
|
double new_x = font_renderer->render_text(ren_buf, (double) text_size, agg_color, (double) x, (double) (height - y), text);
|
||||||
return int(new_x);
|
return int(new_x);
|
||||||
}
|
}
|
||||||
|
|
|
@ -335,9 +335,8 @@ void ren_draw_image(RenImage *image, RenRect *sub, int x, int y, RenColor color)
|
||||||
|
|
||||||
int ren_draw_text(RenFont *font, const char *text, int x, int y, RenColor color) {
|
int ren_draw_text(RenFont *font, const char *text, int x, int y, RenColor color) {
|
||||||
SDL_Surface *surf = SDL_GetWindowSurface(window);
|
SDL_Surface *surf = SDL_GetWindowSurface(window);
|
||||||
// FIXME: pixels are arranged in bgra order while AGG::fontrender use rgb
|
|
||||||
RenColor *pixels = (RenColor*) surf->pixels;
|
RenColor *pixels = (RenColor*) surf->pixels;
|
||||||
return FontRendererDrawText(font->renderer, pixels, surf->w, surf->h, surf->pitch, text, font->height, x, y, color);
|
return FontRendererDrawText(font->renderer, pixels, surf->w, surf->h, surf->pitch, text, font->height * 0.8, x, y, color);
|
||||||
#if 0
|
#if 0
|
||||||
RenRect rect;
|
RenRect rect;
|
||||||
const char *p = text;
|
const char *p = text;
|
||||||
|
|
Loading…
Reference in New Issue