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

Method BaseMouseDown

src/openrct2-ui/windows/MapGen.cpp:363–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361 }
362
363 void BaseMouseDown(WidgetIndex widgetIndex, Widget* widget)
364 {
365 if (_settings.algorithm == MapGenerator::Algorithm::simplexNoise)
366 SimplexMouseDown(widgetIndex, widget);
367
368 else if (_settings.algorithm == MapGenerator::Algorithm::heightmapImage)
369 HeightmapMouseDown(widgetIndex, widget);
370
371 switch (widgetIndex)
372 {
373 case WIDX_MAP_SIZE_Y_UP:
374 _resizeDirection = ResizeDirection::Y;
375 ChangeMapSize(+1);
376 invalidate();
377 break;
378 case WIDX_MAP_SIZE_Y_DOWN:
379 _resizeDirection = ResizeDirection::Y;
380 ChangeMapSize(-1);
381 invalidate();
382 break;
383 case WIDX_MAP_SIZE_X_UP:
384 _resizeDirection = ResizeDirection::X;
385 ChangeMapSize(+1);
386 invalidate();
387 break;
388 case WIDX_MAP_SIZE_X_DOWN:
389 _resizeDirection = ResizeDirection::X;
390 ChangeMapSize(-1);
391 invalidate();
392 break;
393 case WIDX_HEIGHTMAP_SOURCE_DROPDOWN:
394 {
395 using namespace Dropdown;
396
397 constexpr ItemExt items[] = {
398 ToggleOption(0, STR_HEIGHTMAP_FLATLAND),
399 ToggleOption(1, STR_HEIGHTMAP_SIMPLEX_NOISE),
400 ToggleOption(2, STR_HEIGHTMAP_FILE),
401 };
402
403 SetItems(items);
404
405 Widget* ddWidget = &widgets[widgetIndex - 1];
406 WindowDropdownShowTextCustomWidth(
407 { windowPos.x + ddWidget->left, windowPos.y + ddWidget->top }, ddWidget->height(), colours[1], 0,
408 Dropdown::Flag::StayOpen, std::size(items), ddWidget->width() - 3);
409
410 gDropdown.items[EnumValue(_settings.algorithm)].setChecked(true);
411 break;
412 }
413 }
414 }
415
416 void BaseUpdate()
417 {

Callers

nothing calls this directly

Calls 8

SetItemsFunction · 0.85
EnumValueFunction · 0.85
heightMethod · 0.80
widthMethod · 0.80
setCheckedMethod · 0.80
ToggleOptionFunction · 0.70
invalidateFunction · 0.50

Tested by

no test coverage detected