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

Function viewportShiftPixels

src/OpenLoco/src/Ui/WindowManager.cpp:1429–1507  ·  view source on GitHub ↗

* 0x004C6A40 * * @param window @ * @param viewport @ */

Source from the content-addressed store, hash-verified

1427 * @param viewport @<esi>
1428 */
1429 void viewportShiftPixels(Ui::Window* window, Ui::Viewport* viewport, int32_t dX, int32_t dY)
1430 {
1431 const auto index = indexOf(*window);
1432 for (auto it = _windows.begin() + index; it != _windows.end(); it++)
1433 {
1434 auto& w = *it;
1435 if (!w.isTranslucent())
1436 {
1437 continue;
1438 }
1439
1440 if (viewport == w.viewports[0])
1441 {
1442 continue;
1443 }
1444
1445 if (viewport == w.viewports[1])
1446 {
1447 continue;
1448 }
1449
1450 if (viewport->x + viewport->width <= w.x)
1451 {
1452 continue;
1453 }
1454
1455 if (w.x + w.width <= viewport->x)
1456 {
1457 continue;
1458 }
1459
1460 if (viewport->y + viewport->height <= w.y)
1461 {
1462 continue;
1463 }
1464
1465 if (w.y + w.height <= viewport->y)
1466 {
1467 continue;
1468 }
1469
1470 auto left = w.x;
1471 auto top = w.y;
1472 auto right = w.x + w.width;
1473 auto bottom = w.y + w.height;
1474
1475 // TODO: replace these with min/max
1476 auto cx = viewport->x;
1477 if (left < cx)
1478 {
1479 left = cx;
1480 }
1481
1482 cx = viewport->x + viewport->width;
1483 if (right > cx)
1484 {
1485 right = cx;
1486 }

Callers 1

viewportMoveFunction · 0.85

Calls 6

indexOfFunction · 0.85
viewportRedrawAfterShiftFunction · 0.85
renderFunction · 0.70
beginMethod · 0.45
endMethod · 0.45
isTranslucentMethod · 0.45

Tested by

no test coverage detected