本文整理汇总了C++中MapPoint::equals方法的典型用法代码示例。如果您正苦于以下问题:C++ MapPoint::equals方法的具体用法?C++ MapPoint::equals怎么用?C++ MapPoint::equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapPoint
的用法示例。
在下文中一共展示了MapPoint::equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onTouchEnded
void PropColumnMenu::onTouchEnded(Touch *pTouch, Event *pEvent)
{
Point point = pTouch->getLocation();
Rect rect = Rect::ZERO;
rect.origin = m_propColumn->convertToWorldSpace(Point::ZERO);
rect.size = m_propColumn->getContentSize();
if (rect.containsPoint(point))
{
point = m_propColumn->convertToNodeSpace(point);
int x = (int)point.x / GRID_WIDTH;
int y = (int)point.y / GRID_HEIGHT;
y = ROW - y - 1;
m_propVec[m_editProp->getTag()]->setVisible(true);
this->swapProp(m_editProp->getTag(), y*COL+x);
}
else
{
if (m_editProp->getOpacity() == 255)
{
GAME_UILAYER->getOperationMenu()->addDrugs(2001);
ControlButton* btn = GAME_UILAYER->getOperationMenu()->getDrugsBtn();
btn->stopAllActions();
ScaleTo* scaleTo = ScaleTo::create(0.1f, 1.0f);
btn->runAction(scaleTo);
m_propVec[m_editProp->getTag()]->removeFromParent();
m_propVec[m_editProp->getTag()] = NULL;
}
else
{
float r = CCRANDOM_0_1();
if (r ==1)
r = 0;
BgMap* bgMap = GAME_SCENE->getCurrBgMap();
MapPoint playerPosition = MapPoint(Player::sharePlayer()->getPosition());
MapPoint point = MapPointZero;
std::vector<MapPoint> mapVec;
M_INT lenght = 1;
do
{
mapVec = playerPosition.getMapPointVectorForDistance(lenght);
unsigned int index = 0;
for (; index<mapVec.size(); index++)
{
if (GAME_SCENE->getMapPointForProp(MapPoint(mapVec.at(index))) == NULL)
{
point = MapPoint(mapVec.at(index));
}
}
CC_BREAK_IF(!point.equals(MapPointZero));
lenght++;
}
while (1);
PropIconShow* show = m_propVec[m_editProp->getTag()];
m_propVec[m_editProp->getTag()] = NULL;
show->setVisible(true);
show->retain();
show->removeFromParent();
show->setPosition(point.getCCPointValue());
bgMap->addChild(show, BgMap::getZOrderZero(bgMap));
show->release();
show->setScale(0.8f);
GAME_SCENE->insterMapPointForProp(show, point);
show->setOpacity(0);
FadeIn* fadeIn = FadeIn::create(0.1f);
JumpBy* jumpBy = JumpBy::create(0.3f, Point::ZERO, 30, 1);
Spawn* spawn = Spawn::create(fadeIn, jumpBy, NULL);
show->runAction(spawn);
}
}
m_editProp->removeFromParent();
m_editProp = NULL;
}