MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DrawWidget

Method DrawWidget

src/engine_gui.cpp:107–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105 }
106
107 void DrawWidget(const Rect &r, WidgetID widget) const override
108 {
109 if (widget != WID_EP_QUESTION) return;
110
111 EngineID engine = static_cast<EngineID>(this->window_number);
112 int y = DrawStringMultiLine(r, GetString(STR_ENGINE_PREVIEW_MESSAGE, GetEngineCategoryName(engine)), TC_FROMSTRING, SA_HOR_CENTER | SA_TOP) + WidgetDimensions::scaled.vsep_wide;
113
114 DrawString(r.left, r.right, y, GetString(STR_ENGINE_NAME, PackEngineNameDParam(engine, EngineNameContext::PreviewNews)), TC_BLACK, SA_HOR_CENTER);
115 y += GetCharacterHeight(FS_NORMAL);
116
117 DrawVehicleEngine(r.left, r.right, this->width >> 1, y + this->vehicle_space / 2, engine, GetEnginePalette(engine, _local_company), EIT_PREVIEW);
118
119 y += this->vehicle_space;
120 DrawStringMultiLine(r.left, r.right, y, r.bottom, GetEngineInfoString(engine), TC_BLACK, SA_CENTER);
121 }
122
123 void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
124 {

Callers

nothing calls this directly

Calls 9

GetEngineCategoryNameFunction · 0.85
PackEngineNameDParamFunction · 0.85
GetCharacterHeightFunction · 0.85
DrawVehicleEngineFunction · 0.85
GetEnginePaletteFunction · 0.85
GetEngineInfoStringFunction · 0.85
DrawStringMultiLineFunction · 0.70
GetStringFunction · 0.70
DrawStringFunction · 0.70

Tested by

no test coverage detected