本文整理汇总了C++中Star::getPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Star::getPosition方法的具体用法?C++ Star::getPosition怎么用?C++ Star::getPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Star
的用法示例。
在下文中一共展示了Star::getPosition方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteSelectedList
void StarMatrix::deleteSelectedList(){
//播放消除音效
Audio::getInstance()->playPop();
for(auto it = selectedList.begin();it != selectedList.end();it++){
Star* star = *it;
m_layer->showEveryScore(selectedListSize,5+(selectedListSize-selectedList.size())*5,selectedListSize-selectedList.size(),star->getPosition(),touchLeft);
selectedList.pop_front();
//粒子效果
showStarParticleEffect(star->getColor(),star->getPosition(),this);
stars[star->getIndexI()][star->getIndexJ()] = nullptr;
star->removeFromParentAndCleanup(true);
return;
}
clearOneByOne =false;
//COMBO效果
showComboEffect(selectedListSize,this);
m_layer->showLinkNum(selectedListSize);
selectedListSize=0;
acceptTouch =true;
adjustMatrix();
if(isEnded()){
acceptTouch=false;
m_layer->hideProps();
m_layer->floatLeftStarMsg(getLeftStarNum());//通知layer弹出剩余星星的信息
CCLOG("ENDED");
}
}
示例2: deleteSelectedList
void StarMatrix::deleteSelectedList()
{
if(selectedList.size() <= 1)
{
m_layer->hideLinkNum();
selectedList.at(0)->setSelected(false);
return;
}
for(auto it = selectedList.begin();it != selectedList.end();it++)
{
Star* star = *it;
showStarParticleEffect(star->getColor(),star->getPosition(),this);
stars[star->getIndexI()][star->getIndexJ()] = nullptr;
star->removeFromParentAndCleanup(true);
Audio::getInstance()->playPop();
}
showComboEffect(selectedList.size(),this);
Audio::getInstance()->playCombo(selectedList.size());
refreshScore();
m_layer->showLinkNum(selectedList.size());
adjustMatrix();
if(isEnded())
{
m_layer->floatLeftStarMsg(getLeftStarNum());
CCLOG("ENDED");
}
}
示例3: ReadAsterismList
AsterismList* ReadAsterismList(istream& in, const StarDatabase& stardb)
{
AsterismList* asterisms = new AsterismList();
Tokenizer tokenizer(&in);
Parser parser(&tokenizer);
while (tokenizer.nextToken() != Tokenizer::TokenEnd)
{
if (tokenizer.getTokenType() != Tokenizer::TokenString)
{
DPRINTF(0, "Error parsing asterism file.\n");
for_each(asterisms->begin(), asterisms->end(), deleteFunc<Asterism*>());
delete asterisms;
return NULL;
}
string name = tokenizer.getStringValue();
Asterism* ast = new Asterism(name);
Value* chainsValue = parser.readValue();
if (chainsValue == NULL || chainsValue->getType() != Value::ArrayType)
{
DPRINTF(0, "Error parsing asterism %s\n", name.c_str());
for_each(asterisms->begin(), asterisms->end(), deleteFunc<Asterism*>());
delete asterisms;
delete chainsValue;
return NULL;
}
Array* chains = chainsValue->getArray();
for (int i = 0; i < (int) chains->size(); i++)
{
if ((*chains)[i]->getType() == Value::ArrayType)
{
Array* a = (*chains)[i]->getArray();
Asterism::Chain* chain = new Asterism::Chain();
for (Array::const_iterator iter = a->begin(); iter != a->end(); iter++)
{
if ((*iter)->getType() == Value::StringType)
{
Star* star = stardb.find((*iter)->getString());
if (star != NULL)
chain->insert(chain->end(), star->getPosition());
}
}
ast->addChain(*chain);
}
}
asterisms->insert(asterisms->end(), ast);
delete chainsValue;
}
return asterisms;
}
示例4: isInitFinish
bool PopStar::isInitFinish()
{
Star* star = stars[ROW_NUM-1][COL_NUM-1];
if (star)
{
CCPoint pos = star->getPosition();
CCPoint destPos = star->getDestPos();
if ( pos.equals(destPos) )
{
return true;
}
}
return false;
}
示例5: deleteBombList
void StarMatrix::deleteBombList(){
//播放消除音效
Audio::getInstance()->playPropBomb();
for(auto it = selectedList.begin();it != selectedList.end();it++){
Star* star = *it;
//粒子效果
showStarParticleEffect(star->getColor(),star->getPosition(),this);
stars[star->getIndexI()][star->getIndexJ()] = nullptr;
star->removeFromParentAndCleanup(true);
}
selectedList.clear();
//COMBO效果
selectedListSize=0;
acceptTouch =true;
adjustMatrix();
if(isEnded()){
acceptTouch=false;
m_layer->hideProps();
m_layer->floatLeftStarMsg(getLeftStarNum());
}
}
示例6: clearStarAt
void GameLayer::clearStarAt(CCPoint point) {
int col = (int) point.x / TILE;
int row = (int) (_screenSize.height - point.y) / TILE;
if (row < 0 || col < 0 || row >= _manager->getRows() || col >= _manager->getColumns() ||
row * _manager->getColumns() + col >= STARS_IN_POOL) {
return;
}
//identify cell in array
Star * star = _manager->starFromPool(row * _manager->getColumns() + col);
//CCLOG ("COL: %i ROW: %i", col, row);
if (star->isVisible()) {
float diffx = _moon->getPositionX() - star->getPositionX();
float diffy = _moon->getPositionY() - star->getPositionY();
if ((diffx * diffx + diffy * diffy) <= _moon->getSquaredRadius()) {
int starsCollected = _manager->getCollectedStars();
int totalStarsCollected = _manager->getTotalCollectedStars();
starsCollected++;
totalStarsCollected++;
_manager->setCollectedStars(starsCollected);
_manager->setTotalCollectedStars(totalStarsCollected);
star->setVisible(false);
int totalStars = _manager->getTotalStars();
//did we hit a boost?
if (star->getIsBoost()) {
_manager->setBoosting(true);
if (starsCollected != totalStars) {
_boostHitParticles->setPosition(star->getPosition());
_boostHitParticles->resetSystem();
}
}
//if last star on screen, show particles, show Moon Perch...
if (starsCollected == totalStars) {
SimpleAudioEngine::sharedEngine()->playEffect("last_star_hit.wav");
_starHitParticles->setPosition(star->getPosition());
_starHitParticles->resetSystem();
_starsCollected = true;
if (_sun->isVisible()) {
_moonPerch->setOpacity(100);
} else {
_moonPerch->setOpacity(200);
}
} else {
if (star->getIsBoost()) {
SimpleAudioEngine::sharedEngine()->playEffect("boost_hit.wav");
} else {
SimpleAudioEngine::sharedEngine()->playEffect("star_hit.wav");
}
}
}
}
}
示例7: createStar
//.........这里部分代码省略.........
uint32 barycenterCatNo = Star::InvalidCatalogNumber;
bool barycenterDefined = false;
string barycenterName;
if (starData->getString("OrbitBarycenter", barycenterName))
{
barycenterCatNo = findCatalogNumberByName(barycenterName);
barycenterDefined = true;
}
else if (starData->getNumber("OrbitBarycenter", barycenterCatNo))
{
barycenterDefined = true;
}
if (barycenterDefined)
{
if (barycenterCatNo != Star::InvalidCatalogNumber)
{
// We can't actually resolve the barycenter catalog number
// to a Star pointer until after all stars have been loaded
// and spatially sorted. Just store it in a list to be
// resolved after sorting.
BarycenterUsage bc;
bc.catNo = catalogNumber;
bc.barycenterCatNo = barycenterCatNo;
barycenters.push_back(bc);
// Even though we can't actually get the Star pointer for
// the barycenter, we can get the star information.
Star* barycenter = findWhileLoading(barycenterCatNo);
if (barycenter != NULL)
{
hasBarycenter = true;
barycenterPosition = barycenter->getPosition();
}
}
if (!hasBarycenter)
{
cerr << _("Barycenter ") << barycenterName << _(" does not exist.\n");
return false;
}
}
}
if (hasRotationModel)
details->setRotationModel(rm);
}
if (!modifyExistingDetails)
star->setDetails(details);
if (disposition != ModifyStar)
star->setCatalogNumber(catalogNumber);
// Compute the position in rectangular coordinates. If a star has an
// orbit and barycenter, it's position is the position of the barycenter.
if (hasBarycenter)
{
star->setPosition(barycenterPosition);
}
else
{
double ra = 0.0;
double dec = 0.0;
double distance = 0.0;
if (disposition == ModifyStar)