s32 Menu::coordinatesToIndex(s32 x, s32 y) { ISceneCollisionManager* collision = _game->getDevice( )->getSceneManager()->getSceneCollisionManager(); ISceneNode* node = collision->getSceneNodeFromScreenCoordinatesBB( vector2d<s32>(x, y), 0, false, _rootNode); return _buttons.linear_search(node); }
void IdleBoard::Execute(BattleBoard* pField, u32 elapsedTime) { HandleEvent(pField, elapsedTime); // check if there are clicked card static EventReceiver* pEventReceiver = &(EventRcv); position2di posMouse; if (pEventReceiver->IsLeftMouseBtnDown(posMouse)) { pEventReceiver->SetLeftMouseBtnDown(false); ISceneCollisionManager* pCollisionManager = IrrDvc.GetSmgr()->getSceneCollisionManager(); ISceneNode* pSelectedCard = pCollisionManager->getSceneNodeFromScreenCoordinatesBB(posMouse); // send message Dispatcher->DispatchMsg(SEND_MSG_IMMEDIATELY, pField->ID(), pSelectedCard->getID(), MSG_CARD_CLICKED, null); } }