mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-06 06:32:56 +01:00
set font when drawing checkboxes, extracted draw string left centred to new method
This commit is contained in:
@@ -110,6 +110,7 @@ void gfx_draw_string_left(rct_drawpixelinfo *dpi, int format, void *args, int co
|
||||
void gfx_draw_string_left_clipped(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y, int width);
|
||||
int gfx_draw_string_left_wrapped(rct_drawpixelinfo *dpi, void *args, int x, int y, int width, int format, int colour);
|
||||
void draw_string_left_underline(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y);
|
||||
void gfx_draw_string_left_centred(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y);
|
||||
void gfx_draw_string_centred(rct_drawpixelinfo *dpi, int format, int x, int y, int colour, void *args);
|
||||
void gfx_draw_string_centred_clipped(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y, int width);
|
||||
void draw_string_centred_underline(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y);
|
||||
|
||||
@@ -707,10 +707,24 @@ void gfx_draw_string_left(rct_drawpixelinfo *dpi, int format, void *args, int co
|
||||
|
||||
buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char);
|
||||
format_string(buffer, format, args);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 0xE0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
|
||||
gfx_draw_string(dpi, buffer, colour, x, y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws text that is left aligned and vertically centred.
|
||||
*/
|
||||
void gfx_draw_string_left_centred(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y)
|
||||
{
|
||||
char* buffer;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
|
||||
buffer = (char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER;
|
||||
format_string(buffer, format, args);
|
||||
int height = string_get_height_raw(buffer);
|
||||
gfx_draw_string(dpi, buffer, colour, x, y - (height / 2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the palette so that the next character changes colour
|
||||
*/
|
||||
|
||||
@@ -766,11 +766,7 @@ static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
|
||||
colour |= 0x40;
|
||||
}
|
||||
|
||||
// TODO extract this to a string method and maybe a draw vertically centred
|
||||
char *buffer = (char*)RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER;
|
||||
format_string(buffer, (rct_string_id)widget->image, (void*)0x013CE952);
|
||||
int height = string_get_height_raw(buffer);
|
||||
gfx_draw_string(dpi, buffer, colour, l + 14, yMid - (height / 2));
|
||||
gfx_draw_string_left_centred(dpi, (rct_string_id)widget->image, (void*)0x013CE952, colour, l + 14, yMid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1222,6 +1222,8 @@ static void window_options_paint()
|
||||
break;
|
||||
case WINDOW_OPTIONS_PAGE_CULTURE:
|
||||
gfx_draw_string_left(dpi, 2776, w, w->colours[1], w->x + 10, w->y + window_options_culture_widgets[WIDX_LANGUAGE].top + 1);
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
|
||||
gfx_draw_string(
|
||||
dpi,
|
||||
(char*)language_names[gCurrentLanguage],
|
||||
|
||||
Reference in New Issue
Block a user