MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / onResize

Function onResize

src/OpenLoco/src/Ui/Windows/TownWindow.cpp:233–261  ·  view source on GitHub ↗

0x004993A5

Source from the content-addressed store, hash-verified

231
232 // 0x004993A5
233 static void onResize(Window& self)
234 {
235 // Call to sub_498E9B has been deliberately omitted.
236
237 self.setSize({ 192, 161 }, { 600, 440 });
238
239 if (self.viewports[0] != nullptr)
240 {
241 uint16_t newWidth = self.width - 30;
242 if (!SceneManager::isEditorMode() && !SceneManager::isSandboxMode())
243 {
244 newWidth += 22;
245 }
246
247 uint16_t newHeight = self.height - 59;
248
249 auto& viewport = self.viewports[0];
250 if (newWidth != viewport->width || newHeight != viewport->height)
251 {
252 viewport->width = newWidth;
253 viewport->height = newHeight;
254 viewport->viewWidth = newWidth << viewport->zoom;
255 viewport->viewHeight = newHeight << viewport->zoom;
256 self.savedView.clear();
257 }
258 }
259
260 initViewport(self);
261 }
262
263 // 0x00499A87
264 static void initViewport(Window& self)

Callers

nothing calls this directly

Calls 5

isEditorModeFunction · 0.85
isSandboxModeFunction · 0.85
setSizeMethod · 0.80
initViewportFunction · 0.70
clearMethod · 0.45

Tested by

no test coverage detected