本文整理汇总了C++中PlayerPtr::getPos方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPtr::getPos方法的具体用法?C++ PlayerPtr::getPos怎么用?C++ PlayerPtr::getPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPtr
的用法示例。
在下文中一共展示了PlayerPtr::getPos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drawPlayers
void Scene::drawPlayers()
{
for( int i = 0; i < playerPtrs.size(); i++ )
{
PlayerPtr player = playerPtrs[i];
gl::Texture &sprite = playerSprites[i];
SpriteInfo &info = spriteInfo[i];
// Draw Player
gl::pushMatrices();
gl::translate( player->getPos() );
// Invert y axis to draw the image normally
// * Note that this is done after the translation
gl::scale(1, -1);
gl::enableAlphaBlending();
glEnable(GL_TEXTURE_2D);
sprite.enableAndBind();
glBegin(GL_QUADS);
float frame = player->getFrame();
glTexCoord2f( (info.width * frame)/info.sheetWidth, 0 );
glVertex2f( 0, 0);
glTexCoord2f( (info.width * frame + info.width)/info.sheetWidth, 0 );
glVertex2f( info.width, 0 );
glTexCoord2f( (info.width * frame + info.width)/ info.sheetWidth, 1 );
glVertex2f( info.width, info.width);
glTexCoord2f( (info.width * frame)/info.sheetWidth, 1 );
glVertex2f( 0, info.width);
glEnd();
sprite.unbind();
glDisable(GL_TEXTURE_2D);
gl::disableAlphaBlending();
gl::popMatrices();
// Draw Hit Box for testing purposes
if(DRAW_HITBOX)
{
ci::Vec4f box = player->getHitBox();
if( box.z > 0.0f )
{
gl::pushMatrices();
gl::drawSolidCircle( box.xy(), box.z );
gl::popMatrices();
}
}
if( player->mustServe() )
{
gl::pushMatrices();
gl::scale(1, -1);
glEnable( GL_TEXTURE_2D );
gl::enableAlphaBlending();
mText->drawString( "PLAYER " + std::to_string(i+1) + " SERVE", Vec2f( WINDOW_WIDTH * (-0.2f/2.0f), -WINDOW_HEIGHT * 0.40f ) );
gl::disableAlphaBlending();
glDisable( GL_TEXTURE_2D );
gl::popMatrices();
}
}
}