void gameScreen(void) { int ch; setCursorType(); mapDraw(nStage); while (1) { ch = _getch(); if (ch == 0 || ch == 224) { ch = _getch(); switch (ch) { case UP: case DOWN: case LEFT: case RIGHT: Move(ch); break; } } else { switch (ch) { case 'm': case 'M': chooseMenu(); clrscr(); mapDraw(nStage); } } } }
void Cursor::render() { updateFadeLevel(); updateHintDelay(); if (!_gfx->isPosInScreenBounds(_mousePos)) { setCursorType(Cursor::kPassive); } if (_mouseText && _gfx->gameViewport().contains(_mousePos) && _hintDisplayDelay <= 0) { _gfx->setScreenViewport(false); // TODO: Should probably query the image for the width of the cursor // TODO: Add delay to the mouse hints like in the game const int16 cursorDistance = 32; Common::Rect mouseRect = _mouseText->getRect(); Common::Point pos = _gfx->convertCoordinateCurrentToOriginal(_mousePos); pos.x = CLIP<int16>(pos.x, 48, Gfx::Driver::kOriginalWidth - 48); pos.y = CLIP<int16>(pos.y, Gfx::Driver::kTopBorderHeight, Gfx::Driver::kOriginalHeight - Gfx::Driver::kBottomBorderHeight - cursorDistance - mouseRect.height()); pos.x -= mouseRect.width() / 2; pos.y += cursorDistance; _mouseText->render(pos); } if (_currentCursorType != kImage) { _cursorImage = StarkStaticProvider->getCursorImage(_currentCursorType); } if (_cursorImage) { _gfx->setScreenViewport(true); // Unscaled viewport so that cursor is drawn on native pixel space, thus no 'skipping', perform scaling below instead _cursorImage->setFadeLevel(_fadeLevel); _cursorImage->render(_mousePos, true, false); // Draws image (scaled) } }
void WindowEventProducer::updateCursor(Pnt2f MousePos) { CursorRegionListItor ListItor; bool CursorChanged(false); for(ListItor = _CursorRegions.begin() ; ListItor != _CursorRegions.end() ; ++ListItor) { if(MousePos.x() >= ListItor->_TopLeft.x() && MousePos.y() >= ListItor->_TopLeft.y() && MousePos.x() <= ListItor->_BottomRight.x() && MousePos.y() <= ListItor->_TopLeft.y()) { setCursorType(ListItor->_CursorType); CursorChanged = true; } } if(!CursorChanged) { setCursorType(CURSOR_POINTER); } }
Cursor::Cursor(Gfx::Driver *gfx) : _gfx(gfx), _cursorImage(nullptr), _mouseText(nullptr), _currentCursorType(kImage), _fading(false), _fadeLevelIncreasing(true), _fadeLevel(0), _hintDisplayDelay(150) { setCursorType(kDefault); }
static void restoreCursor( const CursorState * cs ) { setCursorPosition( cs->x, cs->y, 0 ); setCursorType( cs->type ); }
static void changeCursor( int col, int row, int type, CursorState * cs ) { if (cs) getCursorPositionAndType( &cs->x, &cs->y, &cs->type ); setCursorType( type ); setCursorPosition( col, row, 0 ); }