mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
(svn r15782) -Codechange: replace some calls to the all text drawing API to the new one.
This commit is contained in:
parent
971ed8d2a3
commit
8a758beec3
@ -96,7 +96,6 @@ int DrawString(int left, int right, int top, const char *str, TextColour colour,
|
||||
int DrawString(int left, int right, int top, StringID str, TextColour colour, TextAlignment align = TA_LEFT, bool underline = false);
|
||||
|
||||
int DrawStringCentered(int x, int y, StringID str, TextColour colour);
|
||||
int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, TextColour colour);
|
||||
int DoDrawStringCentered(int x, int y, const char *str, TextColour colour);
|
||||
|
||||
int DrawString(int x, int y, StringID str, TextColour colour);
|
||||
@ -106,7 +105,6 @@ int DoDrawString(const char *string, int x, int y, TextColour colour, bool parse
|
||||
int DoDrawStringTruncated(const char *str, int x, int y, TextColour colour, uint maxw);
|
||||
|
||||
int DrawStringCenterUnderline(int x, int y, StringID str, TextColour colour);
|
||||
int DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, TextColour colour);
|
||||
|
||||
int DrawStringRightAligned(int x, int y, StringID str, TextColour colour);
|
||||
int DrawStringRightAlignedTruncated(int x, int y, StringID str, TextColour colour, uint maxw);
|
||||
|
@ -421,7 +421,7 @@ public:
|
||||
DrawSprite(sprite, pal, this->widget[NCLWW_CHECKBOX].left + (pal == PAL_NONE ? 3 : 4), y + (pal == PAL_NONE ? 1 : 0));
|
||||
|
||||
StringID str = STR_CONTENT_TYPE_BASE_GRAPHICS + ci->type - CONTENT_TYPE_BASE_GRAPHICS;
|
||||
DrawStringCenteredTruncated(this->widget[NCLWW_TYPE].left, this->widget[NCLWW_TYPE].right, y, str, TC_BLACK);
|
||||
DrawString(this->widget[NCLWW_TYPE].left, this->widget[NCLWW_TYPE].right, y, str, TC_BLACK, TA_CENTER);
|
||||
|
||||
SetDParamStr(0, ci->name);
|
||||
DrawStringTruncated(this->widget[NCLWW_NAME].left + 5, y, STR_JUST_RAW_STRING, TC_BLACK, this->widget[NCLWW_NAME].right - this->widget[NCLWW_NAME].left - 5);
|
||||
|
@ -408,10 +408,10 @@ public:
|
||||
|
||||
|
||||
SetDParamStr(0, sel->info.server_name);
|
||||
DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, STR_JUST_RAW_STRING, TC_ORANGE); // game name
|
||||
DrawString(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, STR_JUST_RAW_STRING, TC_ORANGE, TA_CENTER); // game name
|
||||
|
||||
SetDParamStr(0, sel->info.map_name);
|
||||
DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 74, STR_JUST_RAW_STRING, TC_BLACK); // map name
|
||||
DrawString(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 74, STR_JUST_RAW_STRING, TC_BLACK, TA_CENTER); // map name
|
||||
|
||||
SetDParam(0, sel->info.clients_on);
|
||||
SetDParam(1, sel->info.clients_max);
|
||||
|
@ -107,11 +107,11 @@ struct StatusBarWindow : Window {
|
||||
|
||||
/* Draw status bar */
|
||||
if (this->saving) { // true when saving is active
|
||||
DrawStringCenteredTruncated(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_SAVING_GAME, TC_FROMSTRING);
|
||||
DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_SAVING_GAME, TC_FROMSTRING, TA_CENTER);
|
||||
} else if (_do_autosave) {
|
||||
DrawStringCenteredTruncated(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_032F_AUTOSAVE, TC_FROMSTRING);
|
||||
DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_032F_AUTOSAVE, TC_FROMSTRING, TA_CENTER);
|
||||
} else if (_pause_game) {
|
||||
DrawStringCenteredTruncated(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_0319_PAUSED, TC_FROMSTRING);
|
||||
DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_0319_PAUSED, TC_FROMSTRING, TA_CENTER);
|
||||
} else if (this->ticker_scroll > TICKER_STOP && FindWindowById(WC_NEWS_WINDOW, 0) == NULL && _statusbar_news_item.string_id != 0) {
|
||||
/* Draw the scrolling news text */
|
||||
if (!DrawScrollingStatusText(&_statusbar_news_item, this->ticker_scroll, this->widget[SBW_MIDDLE].right - this->widget[SBW_MIDDLE].left - 2)) {
|
||||
@ -119,14 +119,14 @@ struct StatusBarWindow : Window {
|
||||
if (c != NULL) {
|
||||
/* This is the default text */
|
||||
SetDParam(0, c->index);
|
||||
DrawStringCenteredTruncated(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_02BA, TC_FROMSTRING);
|
||||
DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_02BA, TC_FROMSTRING, TA_CENTER);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (c != NULL) {
|
||||
/* This is the default text */
|
||||
SetDParam(0, c->index);
|
||||
DrawStringCenteredTruncated(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_02BA, TC_FROMSTRING);
|
||||
DrawString(this->widget[SBW_MIDDLE].left + 1, this->widget[SBW_MIDDLE].right - 1, 1, STR_02BA, TC_FROMSTRING, TA_CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1243,13 +1243,13 @@ public:
|
||||
this->DrawWidgets();
|
||||
|
||||
SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1));
|
||||
DrawStringCenteredTruncated(this->widget[TBSE_DATEBACKWARD].right, this->widget[TBSE_DATEFORWARD].left, 6, STR_00AF, TC_FROMSTRING);
|
||||
DrawString(this->widget[TBSE_DATEBACKWARD].right, this->widget[TBSE_DATEFORWARD].left, 6, STR_00AF, TC_FROMSTRING, TA_CENTER);
|
||||
|
||||
/* We hide this panel when the toolbar space gets too small */
|
||||
const Widget *panel = &this->widget[TBSE_SPACERPANEL];
|
||||
if (panel->left != panel->right) {
|
||||
DrawStringCenteredTruncated(panel->left + 1, panel->right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING);
|
||||
DrawStringCenteredTruncated(panel->left + 1, panel->right - 1, 11, STR_0222_SCENARIO_EDITOR, TC_FROMSTRING);
|
||||
DrawString(panel->left + 1, panel->right - 1, 1, STR_0221_OPENTTD, TC_FROMSTRING, TA_CENTER);
|
||||
DrawString(panel->left + 1, panel->right - 1, 11, STR_0222_SCENARIO_EDITOR, TC_FROMSTRING, TA_CENTER);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1938,7 +1938,7 @@ struct VehicleViewWindow : Window {
|
||||
|
||||
/* draw the flag plus orders */
|
||||
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, 2, this->widget[VVW_WIDGET_START_STOP_VEH].top + 1);
|
||||
DrawStringCenteredTruncated(this->widget[VVW_WIDGET_START_STOP_VEH].left + 8, this->widget[VVW_WIDGET_START_STOP_VEH].right, this->widget[VVW_WIDGET_START_STOP_VEH].top + 1, str, TC_FROMSTRING);
|
||||
DrawString(this->widget[VVW_WIDGET_START_STOP_VEH].left + 8, this->widget[VVW_WIDGET_START_STOP_VEH].right, this->widget[VVW_WIDGET_START_STOP_VEH].top + 1, str, TC_FROMSTRING, TA_CENTER);
|
||||
this->DrawViewport();
|
||||
}
|
||||
|
||||
|
@ -478,7 +478,7 @@ void Window::DrawWidgets() const
|
||||
GfxFillRect(r.left + 2, r.top + 2, r.right - 2, r.bottom - 2, _colour_gradient[_company_colours[this->owner]][4]);
|
||||
}
|
||||
|
||||
DrawStringCenteredTruncated(r.left + 2, r.right - 2, r.top + 2, wi->data, TC_FROMSTRING);
|
||||
DrawString(r.left + 2, r.right - 2, r.top + 2, wi->data, TC_FROMSTRING, TA_CENTER);
|
||||
break;
|
||||
|
||||
case WWT_DROPDOWN: {
|
||||
|
Loading…
Reference in New Issue
Block a user