本文整理汇总了C++中IPlayer类的典型用法代码示例。如果您正苦于以下问题:C++ IPlayer类的具体用法?C++ IPlayer怎么用?C++ IPlayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IPlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: locker
void CPlayerManager::_PlayerEventNotify( const unsigned long &ulnID,
const unsigned long &ulnEventType )
{
CCriticalSection::Owner locker( m_csUsedClientList );
switch( ulnEventType )
{
case enumClientConnectCreate:
m_usedClientNode.push_back( ulnID );
break;
case enumClientConnectClose:
PLAYER_MAP::iterator it;
if ( m_thePlayers.end() != ( it = m_thePlayers.find( ulnID ) ) )
{
IPlayer *pPlayer = m_thePlayers[ulnID];
ASSERT( pPlayer );
pPlayer->Destroy( NULL );
}
m_usedClientNode.remove( ulnID );
break;
}
}
示例2: TeleportTo
void TeleportTo(Vector3* position)
{
IPlayer* me = GetMe();
if (!me) return;
Player* playerMe = me->GetPlayer();
if (!playerMe) return;
IActor* actorMe = me->vfptr->GetActorInterface(me);
if (!actorMe) return;
IUE4Actor* ue4actor = playerMe->baseclass_0.m_target;
if (!ue4actor) return;
World* GameWorld = GetWorldObject();
if (!GameWorld) return;
//auto const logMsg = boost::str(boost::format("TeleportTo(%.2f,%.2f,%.2f)")
// % position->x % position->y % position->z);
//Chat(logMsg);
Rotation rot{ 0, 0, 0 };
ue4actor->vfptr->GetRotation(ue4actor, &rot);
GameWorld->vfptr->SendRespawnEvent(GameWorld, me->GetPlayer(), position, &rot);
ue4actor->vfptr->LocalRespawn(ue4actor, position, &rot);
}
示例3: while
int CPlayerManager::Helper()
{
while ( WAIT_OBJECT_0 != ::WaitForSingleObject( m_hQuitEvent, 0L ) )
{
/*
* Get data from role-database
*/
size_t dataLength = 0;
const void *pData = m_pDBRoleClient->GetPackFromServer( dataLength );
while( pData && dataLength )
{
KBlock *pBlock = ( KBlock * )( pData );
UINT uID = pBlock->ulIdentity;
if ( uID < m_theEnviroment.lnPlayerMaxCount )
{
IPlayer *pPlayer = m_thePlayers[uID];
ASSERT( pPlayer );
pPlayer->AppendData( pData );
}
pData = m_pDBRoleClient->GetPackFromServer( dataLength );
}
Sleep( 1 );
}
return 0;
}
示例4: main
int main()
{
srand((unsigned)time(NULL));
int playerLen;
int weaponsLen;
GET_ARRAY_LEN(s_playerType, playerLen);
GET_ARRAY_LEN(s_weapons, weaponsLen);
// 假设,游戏中有十位玩家
for (int i = 0; i < 10; i++) {
// 获取随机玩家和武器
int typeIndex = rand() % playerLen;
int weaponIndex = rand() % weaponsLen;
std::string type = s_playerType[typeIndex];
std::string weapon = s_weapons[weaponIndex];
// 获取玩家
IPlayer *p = PlayerFactory::getPlayer(type);
// 从武器库中随机分配武器
p->assignWeapon(weapon);
// 派玩家去执行任务
p->mission();
}
getchar();
return 0;
}
示例5: UseGuards
void UseGuards( IPlayerFactory* f )
{
IPlayer* guard = f->CreatePlayer();
guard->PrintPosition();
delete guard;
}
示例6: SAFE_RELEASE
void CPlayerManager::CleanNetwork()
{
if ( m_pDBRoleClient )
{
m_pDBRoleClient->Shutdown();
m_pDBRoleClient->Cleanup();
SAFE_RELEASE( m_pDBRoleClient );
}
if ( m_pPlayerServer )
{
/* CCriticalSection::Owner locker( m_csUsedClientList );
LIST::iterator it;
for ( it = m_usedClientNode.begin(); it != m_usedClientNode.end(); it ++ )
{
size_t index = *it;
m_pPlayerServer->ShutdownClient( index );
}
*/
m_pPlayerServer->CloseService();
m_pPlayerServer->Cleanup();
SAFE_RELEASE( m_pPlayerServer );
}
CCriticalSection::Owner lock( m_csSystemAction );
/*
* Repeat until stack is empty
*/
while ( !m_freeClientNode.empty() )
{
m_freeClientNode.pop();
}
CCriticalSection::Owner locker( m_csUsedClientList );
m_usedClientNode.erase( m_usedClientNode.begin(), m_usedClientNode.end() );
PLAYER_MAP::iterator it;
for ( it = m_thePlayers.begin(); it != m_thePlayers.end(); it ++ )
{
IPlayer *pPlayer = ( IPlayer * )( ( *it ).second );
ASSERT( pPlayer );
pPlayer->Destroy( NULL );
SAFE_DELETE( pPlayer );
}
m_thePlayers.erase( m_thePlayers.begin(), m_thePlayers.end() );
}
示例7: IsValidEnemy
bool Aimbot::IsValidEnemy( int entityNum )
{
IPlayer * ent = ImportExport::Entities->GetPlayer (entityNum);
if(ent != nullptr && ImportExport::User != nullptr && ent->IsValid())
{
return ent->IsEnemyOf( ImportExport::User ) && ent->Health() > 0 && ent->Weapon().Id() > 0;
}
return false;
}
示例8: android_media_omxmediaplayer_start
JNIEXPORT void android_media_omxmediaplayer_start(JNIEnv *env, jobject thiz)
{
PPLOGI("android_media_omxmediaplayer_start()");
IPlayer* mp = getOMXMediaPlayer(env, thiz);
if (mp == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return;
}
mp->start();
}
示例9: android_media_omxmediaplayer_isLooping
JNIEXPORT jboolean android_media_omxmediaplayer_isLooping(JNIEnv *env, jobject thiz)
{
PPLOGD("isLooping");
IPlayer* mp = getOMXMediaPlayer(env, thiz);
if (mp == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return false;
}
return mp->isLooping();
}
示例10: strdup
bool CVisualisation::Create(int x, int y, int w, int h)
{
m_pInfo = new VIS_PROPS;
#ifdef HAS_DX
m_pInfo->device = g_Windowing.Get3DDevice();
#else
m_pInfo->device = NULL;
#endif
m_pInfo->x = x;
m_pInfo->y = y;
m_pInfo->width = w;
m_pInfo->height = h;
m_pInfo->pixelRatio = g_settings.m_ResInfo[g_graphicsContext.GetVideoResolution()].fPixelRatio;
m_pInfo->name = strdup(Name().c_str());
m_pInfo->presets = strdup(CSpecialProtocol::TranslatePath(Path()).c_str());
m_pInfo->profile = strdup(CSpecialProtocol::TranslatePath(Profile()).c_str());
m_pInfo->submodule = NULL;
if (CAddonDll<DllVisualisation, Visualisation, VIS_PROPS>::Create() == ADDON_STATUS_OK)
{
// Start the visualisation
CStdString strFile = URIUtils::GetFileName(g_application.CurrentFile());
CLog::Log(LOGDEBUG, "Visualisation::Start()\n");
try
{
m_pStruct->Start(m_iChannels, m_iSamplesPerSec, m_iBitsPerSample, strFile);
}
catch (std::exception e)
{
HandleException(e, "m_pStruct->Start() (CVisualisation::Create)");
return false;
}
GetPresets();
if (GetSubModules())
m_pInfo->submodule = strdup(CSpecialProtocol::TranslatePath(m_submodules.front()).c_str());
else
m_pInfo->submodule = NULL;
CreateBuffers();
{
CSingleLock lock(*g_application.getPlayerLock());
IPlayer *player = g_application.getPlayer();
if (player)
player->RegisterAudioCallback(this);
}
return true;
}
return false;
}
示例11: PPLOGI
JNIEXPORT void JNICALL android_media_omxmediaplayer_prepareAsync
(JNIEnv *env, jobject thiz)
{
PPLOGI("OMXPlayer_prepareAsync");
IPlayer* mp = getOMXMediaPlayer(env, thiz);
if (mp == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return;
}
mp->prepareAsync();
}
示例12: android_media_omxmediaplayer_isPlaying
JNIEXPORT jboolean android_media_omxmediaplayer_isPlaying(JNIEnv *env, jobject thiz)
{
IPlayer* mp = getOMXMediaPlayer(env, thiz);
if (mp == NULL ) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return false;
}
const jboolean is_playing = mp->isPlaying();
PPLOGD("isPlaying: %d", is_playing);
return is_playing;
}
示例13: lock
void CVisualisation::Stop()
{
{
CSingleLock lock(*g_application.getPlayerLock());
IPlayer *player = g_application.getPlayer();
if (player)
player->UnRegisterAudioCallback();
}
if (Initialized())
{
CAddonDll<DllVisualisation, Visualisation, VIS_PROPS>::Stop();
}
}
示例14:
/* Returns the IPlayer that matches the IService [s]; overwize returns 0 */
IPlayer * RoomManager::operator()(IService * s) const
{
std::deque<IPlayer *> players = this->hall_->getAllPlayers();
for (std::deque<IPlayer *>::const_iterator it = players.begin() ;
it != players.end() ; ++it)
{
IPlayer *tmp = *it;
if (tmp && tmp->getService() == s)
return tmp;
}
return 0;
}
示例15: getOMXMediaPlayer
/*
* Class: com_gotye_meetsdk_player_OMXPlayer
* Method: getVideoHeight
* Signature: ()I
*/
JNIEXPORT jint JNICALL android_media_omxmediaplayer_getVideoHeight
(JNIEnv *env, jobject thiz)
{
IPlayer* mp = getOMXMediaPlayer(env, thiz);
if (mp == NULL ) {
PPLOGE("player is null, getVideoHeight failed");
return 0;
}
int h;
if (0 != mp->getVideoHeight(&h)) {
PPLOGE("getVideoHeight failed");
h = 0;
}
PPLOGI("getVideoHeight: %d", h);
return h;
}