MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / updateCursor

Method updateCursor

source/frontend/StarMainInterface.cpp:1459–1493  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1457}
1458
1459void MainInterface::updateCursor() {
1460 Maybe<String> cursorOverride = m_actionBar->cursorOverride(m_cursorScreenIPos);
1461
1462 if (!cursorOverride) {
1463 if (auto pane = m_paneManager.getPaneAt(m_cursorScreenIPos / interfaceScale())) {
1464 cursorOverride = cursorOverride.orMaybe(pane->cursorOverride(m_cursorScreenIPos / interfaceScale()));
1465 } else {
1466 auto player = m_client->mainPlayer();
1467 if (auto anchorState = m_client->mainPlayer()->loungingIn()) {
1468 if (auto loungeable = m_client->worldClient()->get<LoungeableEntity>(anchorState->entityId)) {
1469 if (auto loungeAnchor = loungeable->loungeAnchor(anchorState->positionIndex))
1470 cursorOverride = cursorOverride.orMaybe(loungeAnchor->cursorOverride);
1471 }
1472 }
1473 if (!cursorOverride) {
1474 for (auto item : {player->primaryHandItem(), player->altHandItem()}) {
1475 if (auto activeItem = as<ActiveItem>(item)) {
1476 if (auto cursor = activeItem->cursor()) {
1477 cursorOverride = cursor;
1478 break;
1479 }
1480 } else if (auto inspectionTool = as<InspectionTool>(item)) {
1481 cursorOverride = String("/cursors/inspect.cursor");
1482 break;
1483 }
1484 }
1485 }
1486 }
1487 }
1488
1489 if (cursorOverride)
1490 m_cursor.setCursor(cursorOverride.take());
1491 else
1492 m_cursor.resetCursor();
1493}
1494
1495void MainInterface::renderCursor() {
1496 // if we're currently playing a cinematic, we should not render the mouse.

Callers

nothing calls this directly

Calls 14

StringClass · 0.85
getPaneAtMethod · 0.80
orMaybeMethod · 0.80
mainPlayerMethod · 0.80
worldClientMethod · 0.80
cursorMethod · 0.80
setCursorMethod · 0.80
resetCursorMethod · 0.80
cursorOverrideMethod · 0.45
loungingInMethod · 0.45
loungeAnchorMethod · 0.45
primaryHandItemMethod · 0.45

Tested by

no test coverage detected