本文整理汇总了C++中CBaseEntity::GetPosY方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseEntity::GetPosY方法的具体用法?C++ CBaseEntity::GetPosY怎么用?C++ CBaseEntity::GetPosY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseEntity
的用法示例。
在下文中一共展示了CBaseEntity::GetPosY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCamera
void CGamePlayState::GetCamera( int& X , int& Y )
{
CBaseEntity* player = (CBaseEntity*)MObjectManager::GetInstance()->GetUnit( testVaribale );
if( player )
{
X = (int)player->GetPosX() - 800/2 + 32;
Y = (int)player->GetPosY() - 600/2 + 32;
if( X + 800 > MObjectManager::GetInstance()->FindLayer( testVaribale ).GetLayerWidth() * TILE_WIDTH )
X = MObjectManager::GetInstance()->FindLayer( testVaribale ).GetLayerWidth() * TILE_WIDTH - 800;
if( Y + 600 > MObjectManager::GetInstance()->FindLayer( testVaribale ).GetLayerHeight() * TILE_HEIGHT )
Y = MObjectManager::GetInstance()->FindLayer( testVaribale ).GetLayerHeight() * TILE_HEIGHT - 600;
if( X < 0 )
X = 0;
if( Y < 0 )
Y = 0;
}
return ;
}
示例2: Render
void CGamePlayState::Render(void)
{
CSGD_Direct3D* pD3D = CSGD_Direct3D::GetInstance();
CBaseEntity* player = nullptr;
if( testVaribale > 0 )
{
player = (CBaseEntity*)MObjectManager::GetInstance()->GetUnit( testVaribale );
}
else
{
cout << "No player to render\n";
}
if( player )
{
cameraX = (int)player->GetPosX() - 800/2 + 32;
cameraY = (int)player->GetPosY() - 600/2 + 32;
if( cameraX + 800 > MObjectManager::GetInstance()->FindLayer( testVaribale ).GetLayerWidth() * TILE_WIDTH )
cameraX = MObjectManager::GetInstance()->FindLayer( testVaribale ).GetLayerWidth() * TILE_WIDTH - 800;
if( cameraY + 600 > MObjectManager::GetInstance()->FindLayer( testVaribale ).GetLayerHeight() * TILE_HEIGHT )
cameraY = MObjectManager::GetInstance()->FindLayer( testVaribale ).GetLayerHeight() * TILE_HEIGHT - 600;
if( cameraX < 0 )
cameraX = 0;
if( cameraY < 0 )
cameraY = 0;
MObjectManager::GetInstance()->Render( cameraX, cameraY, MObjectManager::GetInstance()->FindLayer( testVaribale ).GetLayerID() );
}
else
{
MObjectManager::GetInstance()->Render( 0, 0, 0 );
}
//Draw the HUD
CHUD::GetInstance()->Render();
//pD3D->DrawTextA( "Gameplay State", 100, 100 );
int mouseX = CSGD_DirectInput::GetInstance()->MouseGetPosX() ;
int mouseY = CSGD_DirectInput::GetInstance()->MouseGetPosY() ;
if( m_bDrawMouse )
CSGD_TextureManager::GetInstance()->Draw( m_nMouseID , mouseX - 8 , mouseY - 2 ) ;
MMessageSystem::GetInstance()->ProcessMessages();
//char temp[64];
//sprintf_s( temp, "%f", timestep );
//sprintf( temp, "%f", timestep );
//CSGD_Direct3D::GetInstance()->DrawTextA( temp, 100, 126 );
//sprintf( temp, "%f", 1.0f / timestep );
//CSGD_Direct3D::GetInstance()->DrawTextA( temp, 100, 164 );
if( m_bIsOver )
{
int fade = int( 255 * ( m_fCountdown / 10.0f ) );
if( fade > 255 )
fade = 255;
CSGD_TextureManager::GetInstance()->Draw( m_nIMG_Black, 0, 0, 1.0f, 1.0f, 0, 0.0f, 0.0f, 0.0f, D3DCOLOR_ARGB( fade, 255, 255, 255 ) );
MetalText.Print( "But Now You Must Escape . . .", 800 / 2 - 256, 600 / 2, 0.5f );
}
}