/** * @brief 设置状态 * @param eStatus 要设置的状态,查看enum UISYS_STATUS * @return 此次设置状态的句柄,在释放的时候要使用到 */ void KUiBase::SetStatus(UISYS_STATUS eStatus, int &nHandle) { if(eStatus != UIS_S_IDLE) { STATUS_HANDLE_LIST::iterator itNode; if((itNode = m_sStatusHandleList.find(nHandle)) != m_sStatusHandleList.end()) { m_aryStatus[&(itNode->second)]--; //对于eStatus,&操作符重载为另外一个含义 itNode->second = eStatus; } else { m_nStatusHandleCount++; if(m_nStatusHandleCount < 1) { m_nStatusHandleCount = 1; } m_sStatusHandleList[m_nStatusHandleCount] = eStatus; nHandle = m_nStatusHandleCount; } m_aryStatus[&eStatus] ++; //对于eStatus,&操作符重载为另外一个含义 Wnd_GameSpaceHandleInput(!GetStatus()); SetCurrentCursor(); } }
void TCursorSprite::SetFocus(RWsTextCursor* aFocus,CWsClientWindow* aWin/*=NULL*/) { if (iCurrentCursor!=aFocus) { Hide(); SetCurrentCursor(aFocus, aWin); } }
void Initialise() { Guard::Assert(!_initialised, "Cursors have already been initialised."); _initialised = true; // Using system cursors _loadedCursors[CURSOR_ARROW] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW); _loadedCursors[CURSOR_HAND_POINT] = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_HAND); // Using custom cursors for (size_t i = 0; i < CURSOR_COUNT; i++) { const CursorData * cursorData = GetCursorData((CURSOR_ID)i); if (cursorData != nullptr) { _loadedCursors[i] = Create(cursorData); } } _currentCursor = CURSOR_UNDEFINED; SetCurrentCursor(CURSOR_ARROW); }