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

Function GameHandleEdgeScroll

src/openrct2-ui/input/MouseInput.cpp:1589–1622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

handleViewScrollingMethod · 0.85

Calls 8

WindowGetMainFunction · 0.85
ContextHasFocusFunction · 0.85
ContextGetCursorStateFunction · 0.85
ContextGetWidthFunction · 0.85
ContextGetHeightFunction · 0.85
InputScrollViewportFunction · 0.85
hasMethod · 0.65
ScreenCoordsXYClass · 0.50

Tested by

no test coverage detected