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

Function WindowResizeGui

src/openrct2/interface/Window.cpp:730–778  ·  view source on GitHub ↗

* rct2: 0x0066B905 */

Source from the content-addressed store, hash-verified

728 * rct2: 0x0066B905
729 */
730 void WindowResizeGui(int32_t width, int32_t height)
731 {
732 WindowResizeGuiScenarioEditor(width, height);
733 if (isInEditorMode())
734 return;
735
736 auto* windowMgr = Ui::GetWindowManager();
737 WindowBase* titleWind = windowMgr->FindByClass(WindowClass::titleMenu);
738 if (titleWind != nullptr)
739 {
740 titleWind->windowPos.x = (width - titleWind->width) / 2;
741 titleWind->windowPos.y = height - 182;
742 }
743
744 WindowBase* versionWind = windowMgr->FindByClass(WindowClass::titleVersion);
745 if (versionWind != nullptr)
746 versionWind->windowPos.y = height - 30;
747
748 WindowBase* exitWind = windowMgr->FindByClass(WindowClass::titleExit);
749 if (exitWind != nullptr)
750 {
751 exitWind->windowPos.x = width - 40;
752 exitWind->windowPos.y = height - 64;
753 }
754
755 WindowBase* optionsWind = windowMgr->FindByClass(WindowClass::titleOptions);
756 if (optionsWind != nullptr)
757 {
758 optionsWind->windowPos.x = width - 80;
759 }
760
761 // Keep options window centred after a resize
762 WindowBase* optionsWindow = windowMgr->FindByClass(WindowClass::options);
763 if (optionsWindow != nullptr)
764 {
765 optionsWindow->windowPos.x = (ContextGetWidth() - optionsWindow->width) / 2;
766 optionsWindow->windowPos.y = (ContextGetHeight() - optionsWindow->height) / 2;
767 }
768
769 // Keep progress bar window centred after a resize
770 WindowBase* ProgressWindow = windowMgr->FindByClass(WindowClass::progressWindow);
771 if (ProgressWindow != nullptr)
772 {
773 ProgressWindow->windowPos.x = (ContextGetWidth() - ProgressWindow->width) / 2;
774 ProgressWindow->windowPos.y = (ContextGetHeight() - ProgressWindow->height) / 2;
775 }
776
777 GfxInvalidateScreen();
778 }
779
780 /**
781 * rct2: 0x0066F0DD

Callers 4

GameCreateWindowsFunction · 0.85
LoadMethod · 0.85
CreateWindowsMethod · 0.85
UiContext.cppFile · 0.85

Calls 7

isInEditorModeFunction · 0.85
GetWindowManagerFunction · 0.85
ContextGetWidthFunction · 0.85
ContextGetHeightFunction · 0.85
GfxInvalidateScreenFunction · 0.85
FindByClassMethod · 0.45

Tested by

no test coverage detected