MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / onDraw

Method onDraw

src/openrct2-ui/windows/ScenarioSelect.cpp:310–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308 }
309
310 void onDraw(RenderTarget& rt) override
311 {
312 drawWidgets(rt);
313
314 StringId format = STR_WINDOW_COLOUR_2_STRINGID;
315 FontStyle fontStyle = FontStyle::medium;
316
317 if (ScenarioSelectUseSmallFont())
318 {
319 format = STR_SMALL_WINDOW_COLOUR_2_STRINGID;
320 fontStyle = FontStyle::small;
321 }
322
323 // Text for each tab
324 for (uint32_t i = 0; i < std::size(kScenarioOriginStringIds); i++)
325 {
326 const Widget& widget = widgets[WIDX_TAB1 + i];
327 if (widget.type == WidgetType::empty)
328 continue;
329
330 auto ft = Formatter();
331 ft.Add<StringId>(kScenarioOriginStringIds[i]);
332
333 auto stringCoords = windowPos + ScreenCoordsXY{ widget.midX(), widget.midY() - 3 };
334 drawTextWrapped(
335 rt, stringCoords, 87, format, ft, { Drawing::Colour::lightWater, fontStyle, TextAlignment::centre });
336 }
337
338 auto previewPaneWidth = GetPreviewPaneWidth();
339
340 // Return if no scenario highlighted
341 auto* scenario = _highlightedScenario;
342 if (scenario == nullptr)
343 {
344 if (_showLockedInformation)
345 {
346 // Show locked information
347 auto screenPos = windowPos
348 + ScreenCoordsXY{ widgets[WIDX_SCENARIOLIST].right + 4, widgets[WIDX_TABCONTENT].top + 5 };
349 drawTextEllipsised(
350 rt, screenPos + ScreenCoordsXY{ previewPaneWidth / 2, 0 }, previewPaneWidth, STR_SCENARIO_LOCKED,
351 { TextAlignment::centre });
352
353 drawTextWrapped(rt, screenPos + ScreenCoordsXY{ 0, 15 }, previewPaneWidth, STR_SCENARIO_LOCKED_DESC);
354 }
355 else
356 {
357 // Show general information about how to start.
358 auto screenPos = windowPos
359 + ScreenCoordsXY{ widgets[WIDX_SCENARIOLIST].right + 4, widgets[WIDX_TABCONTENT].top + 5 };
360
361 drawTextWrapped(rt, screenPos + ScreenCoordsXY{ 0, 15 }, previewPaneWidth, STR_SCENARIO_HOVER_HINT);
362 }
363 return;
364 }
365
366 // Scenario path
367 if (Config::Get().general.debuggingTools)

Callers

nothing calls this directly

Calls 11

drawTextWrappedFunction · 0.85
drawTextEllipsisedFunction · 0.85
shortenPathFunction · 0.85
drawTextFunction · 0.85
EnumValueFunction · 0.85
formatObjectiveFunction · 0.85
midXMethod · 0.80
midYMethod · 0.80
FormatterClass · 0.70
isValidMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected