| 1587 | } |
| 1588 | |
| 1589 | void GameHandleEdgeScroll() |
| 1590 | { |
| 1591 | WindowBase* mainWindow; |
| 1592 | int32_t scrollX, scrollY; |
| 1593 | |
| 1594 | mainWindow = WindowGetMain(); |
| 1595 | if (mainWindow == nullptr) |
| 1596 | return; |
| 1597 | if (mainWindow->flags.has(WindowFlag::noScrolling) |
| 1598 | || (gLegacyScene == LegacyScene::trackDesignsManager || gLegacyScene == LegacyScene::titleSequence)) |
| 1599 | return; |
| 1600 | if (mainWindow->viewport == nullptr) |
| 1601 | return; |
| 1602 | if (!ContextHasFocus()) |
| 1603 | return; |
| 1604 | |
| 1605 | scrollX = 0; |
| 1606 | scrollY = 0; |
| 1607 | |
| 1608 | // Scroll left / right |
| 1609 | const CursorState* cursorState = ContextGetCursorState(); |
| 1610 | if (cursorState->position.x == 0) |
| 1611 | scrollX = -1; |
| 1612 | else if (cursorState->position.x >= ContextGetWidth() - 1) |
| 1613 | scrollX = 1; |
| 1614 | |
| 1615 | // Scroll up / down |
| 1616 | if (cursorState->position.y == 0) |
| 1617 | scrollY = -1; |
| 1618 | else if (cursorState->position.y >= ContextGetHeight() - 1) |
| 1619 | scrollY = 1; |
| 1620 | |
| 1621 | InputScrollViewport(ScreenCoordsXY(scrollX, scrollY)); |
| 1622 | } |
| 1623 | |
| 1624 | void InputScrollViewport(const ScreenCoordsXY& scrollScreenCoords) |
| 1625 | { |
no test coverage detected