本文整理汇总了C++中Active函数的典型用法代码示例。如果您正苦于以下问题:C++ Active函数的具体用法?C++ Active怎么用?C++ Active使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Active函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: locker
void OSMutexRW::LockWrite()
{
OSMutexLocker locker(&fInternalLock);
AddWriteWaiter(); // 1 writer queued
#if DEBUGMUTEXRW
if (Active())
{ qtss_printf("LockWrite(conflict) state = %d active readers = %d, waiting writers = %d, waiting readers=%d\n", fState, fActiveReaders, fWriteWaiters, fReadWaiters);
CountConflict(1);
}
qtss_printf("LockWrite 'waiting' fState = %d locked active readers = %d, waiting writers = %d, waiting readers=%d\n",fState, fActiveReaders, fReadWaiters, fWriteWaiters);
#endif
//while (ActiveReaders()) // active readers
while (Active())//modify by tex
{
fWritersCond.Wait(&fInternalLock,OSMutexRW::eMaxWait);
}
RemoveWriteWaiter(); // remove from waiting writers
SetState(OSMutexRW::eActiveWriterState); // this is the active writer
fActiveReaders = fState;
#if DEBUGMUTEXRW
// qtss_printf("LockWrite 'locked' fState = %d locked active readers = %d, waiting writers = %d, waiting readers=%d\n",fState, fActiveReaders, fReadWaiters, fWriteWaiters);
#endif
}
示例2: switch
void MenuItem::Mouse(HWND hwnd, UINT uMsg, DWORD wParam, DWORD lParam)
{
int i = 0;
switch(uMsg)
{
case WM_MBUTTONUP:
i = INVOKE_MID;
break;
case WM_RBUTTONUP:
i = INVOKE_RIGHT;
break;
case WM_LBUTTONUP:
i = INVOKE_LEFT;
if (m_pMenu->m_dblClicked)
i |= INVOKE_DBL;
if (0x8000 & GetAsyncKeyState(VK_MENU))
{
if (i & INVOKE_DBL)
i = INVOKE_PROP;
else
i = 0;
}
break;
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
m_pMenu->set_capture(MENU_CAPT_ITEM);
Active(1);
break;
case WM_MOUSEMOVE:
if (m_pMenu->m_captureflg && hwnd != window_under_mouse())
{
// start drag operation on mouseleave
m_pMenu->set_capture(0);
i = INVOKE_DRAG;
break;
}
Active(1);
break;
case WM_MOUSEWHEEL:
m_pMenu->HideChild();
Active(2);
break;
}
if (i && m_bActive && false == m_bNOP)
Invoke(i);
}
示例3: CommitActive
void MasterEntity::PreFrame( bool paused )
{
if( m_Ready && !Active() )
CommitActive();
if( !paused )
GameCall<void>( "GamePreFrame" );
if( m_Controller.Exists() && Active() )
m_Controller->PreFrame();
}
示例4: switch
// Mouse command MOUSEMOVE, LB_PRESSED, ...
void MenuItem::Mouse(HWND hwnd, UINT uMsg, DWORD wParam, DWORD lParam)
{
int i = 0;
switch (uMsg)
{
case WM_MBUTTONUP:
i = INVOKE_MID;
break;
case WM_RBUTTONUP:
i = INVOKE_RIGHT;
break;
case WM_LBUTTONUP:
i = INVOKE_LEFT;
if (m_pMenu->m_dblClicked) i |= INVOKE_DBL;
break;
case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_RBUTTONDOWN:
SetCapture(hwnd);
case WM_MOUSEMOVE:
Active(1);
break;
}
if (i && m_bActive)// && 0 == m_isNOP)
{
Menu::g_DiscardMouseMoves = 5;
Invoke(i);
}
}
示例5: WriteLine
void DriverLog::WriteLine(LPCTSTR message, ...)
{
if (!Active() || message == 0)
return;
m_cs.Enter();
static TCHAR lineStart[512];
int lineStartSize = _stprintf_s(lineStart, 512, _T("[%4d][%6d]"), ::GetCurrentThreadId(), ::GetTickCount() - startTick);
WriteFileLog(lineStart, lineStartSize);
va_list args;
va_start( args, message );
int characters = _vsctprintf(message, args);
if (characters != -1) {
DynamicArray<TCHAR> buffer(characters + 5);
if(-1 != _vstprintf_s(buffer, characters + 5, message, args)) {
WritePipeLog(buffer, characters);
buffer[characters] = _T('\r');
buffer[characters + 1] = _T('\n');
WriteFileLog(buffer, characters + 2);
}
}
m_cs.Leave();
}
示例6: ZGetGame
void ZModule_HealOverTime::BeginHeal(MMatchDamageType type, int nHealAmount, int numHeal, MMatchItemEffectId effectId, int nItemId)
{
if (type != MMDT_HEAL && type != MMDT_REPAIR) { _ASSERT(0); return; }
m_type.Set_CheckCrc(type);
m_nEffectId = effectId;
float fCurrTime = ZGetGame()->GetTime();
m_fBeginTime.Set_CheckCrc(fCurrTime);
m_fHeal.Set_CheckCrc((float)nHealAmount);
m_numHealDesire.Set_CheckCrc(numHeal);
m_numHealDone.Set_CheckCrc(0);
if (!m_bOnHeal.Ref())
{
m_fNextHealTime.Set_CheckCrc(fCurrTime);
}
m_bOnHeal.Set_CheckCrc(true);
m_nItemId = nItemId;
Active();
}
示例7: RSKMAP_ITERATE_VALUE_NAMED
void PhysicsBodyObject::SetActive( bool active )
{
if( active == Active() )
return;
rsk::ActiveObject::SetActive( active );
//
// Encapsulate RSKMAP_ITERATE; duplicate them so only what's needed is run
PhysicsWorld* world = gGame->GetWorld();
if( active )
{
RSKMAP_ITERATE_VALUE_NAMED( m_Detectors, slot )
{
if( slot->active )
{
world->AddBody( slot->area.Self() );
CommitDetectorActive( *slot, active );
}
}
return;
}
if( world )
{
RSKMAP_ITERATE_VALUE_NAMED( m_Detectors, slot )
{
CommitDetectorActive( *slot, active );
world->RemoveBody( slot->area->GetID() );
}
return;
}
示例8: HighQuality
/*
==================
FullscreenFX_DoubleVision::HighQuality
==================
*/
void FullscreenFX_DoubleVision::HighQuality() {
int offset = fxman->GetPlayerView()->dvFinishTime - gameLocal.fast.time;
float scale = offset * g_dvAmplitude.GetFloat();
// for testing purposes
if ( !Active() ) {
static int test = 0;
if ( test > 312 ) {
test = 0;
}
offset = test++;
scale = offset * g_dvAmplitude.GetFloat();
}
idPlayer * player = fxman->GetPlayer();
if( player == NULL ) {
return;
}
offset *= 2; // crutch up for higher res
// set the scale and shift
if ( scale > 0.5f ) {
scale = 0.5f;
}
float shift = scale * sin( sqrtf( (float)offset ) * g_dvFrequency.GetFloat() );
shift = fabs( shift );
// carry red tint if in berserk mode
idVec4 color( 1.0f, 1.0f, 1.0f, 1.0f );
if ( gameLocal.fast.time < player->inventory.powerupEndTime[ BERSERK ] ) {
color.y = 0.0f;
color.z = 0.0f;
}
if ( !common->IsMultiplayer() && gameLocal.fast.time < player->inventory.powerupEndTime[ HELLTIME ] || gameLocal.fast.time < player->inventory.powerupEndTime[ INVULNERABILITY ]) {
color.y = 0.0f;
color.z = 0.0f;
}
// uv coordinates
float s0 = shift;
float t0 = 1.0f;
float s1 = 1.0f;
float t1 = 0.0f;
renderSystem->SetColor4( color.x, color.y, color.z, 1.0f );
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, material );
renderSystem->SetColor4( color.x, color.y, color.z, 0.5f );
s0 = 0.0f;
t0 = 1.0f;
s1 = ( 1.0-shift );
t1 = 0.0f;
renderSystem->DrawStretchPic( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT, s0, t0, s1, t1, material );
}
示例9: SetActive
void cVnsiOsd::SetActive(bool On)
{
if (On != Active())
{
cOsd::SetActive(On);
if (On)
{
// must clear all windows here to avoid flashing effects - doesn't work if done
// in Flush() only for the windows that are actually used...
for (int i = 0; i < MAXNUMWINDOWS; i++)
{
Cmd(VNSI_OSD_CLEAR, i);
}
if (GetBitmap(0)) // only flush here if there are already bitmaps
Flush();
}
else if (shown)
{
for (int i = 0; GetBitmap(i); i++)
{
Cmd(VNSI_OSD_CLOSE, i);
}
shown = false;
}
}
}
示例10: qDebug
void
IrcAbstractChannel::Incoming (const QString & message,
const QString & rawMessage)
{
QString cooked = HtmlMangle::Anchorize (message,
HtmlMangle::HttpExp(),
HtmlMangle::HtmlAnchor);
qDebug () << " cooked message " << cooked;
QDateTime now = QDateTime::currentDateTime ();
QString smalldate ("<span style=\"font-size:small\">"
"%1</span> %2");
QString cookedLine;
cookedLine.append ("<br>\n");
cookedLine.append (smalldate
.arg (now.toString ("hh:mm:ss"))
.arg (cooked));
cookedLog.append (cookedLine);
UpdateCooked ();
if (logging) {
logFile.write (cookedLine.toUtf8());
logFile.flush ();
}
CheckWatch (rawMessage.length() > 0 ? rawMessage : message);
emit Active (this);
}
示例11: switch
RefResult Composite::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget,
PartID& partID, RefMessage message ) {
switch (message) {
case REFMSG_CHANGE:
if (paramDlg)
paramDlg->Invalidate();
if (pblock->LastNotifyParamID() == comptex_tex && pblock->Count(comptex_tex) != subTex.Count())
SetNumMaps(pblock->Count(comptex_tex));
else if (pblock->LastNotifyParamID() == comptex_ons && pblock->Count(comptex_ons) != subTex.Count())
SetNumMaps(pblock->Count(comptex_ons));
DiscardTexHandles(); // DS 5/4/00
ivalid.SetEmpty();
if (paramDlg&&Active())
paramDlg->ip->MtlChanged();
break;
case REFMSG_GET_PARAM_DIM:
return REF_STOP;
case REFMSG_GET_PARAM_NAME: {
GetParamName *gpn = (GetParamName*)partID;
gpn->name= GetSubTexmapSlotName(gpn->index);
return REF_STOP;
}
}
return(REF_SUCCEED);
}
示例12: Active
void
TMagnify::StartSave()
{
fImageFrozenOnSave = Active();
if (fImageFrozenOnSave)
MakeActive(false);
}
示例13: OnRender
void CScoreboard::OnRender()
{
if(!Active())
return;
// if the score board is active, then we should clear the motd message aswell
if(m_pClient->m_pMotd->IsActive())
m_pClient->m_pMotd->Clear();
float Width = 400*3.0f*Graphics()->ScreenAspect();
float Height = 400*3.0f;
Graphics()->MapScreen(0, 0, Width, Height);
float w = 700.0f;
if(m_pClient->m_Snap.m_pGameInfoObj)
{
if(!(m_pClient->m_Snap.m_pGameInfoObj->m_GameFlags&GAMEFLAG_TEAMS))
RenderScoreboard(Width/2-w/2, 150.0f, w, 0, 0);
else
{
const char *pRedClanName = GetClanName(TEAM_RED);
const char *pBlueClanName = GetClanName(TEAM_BLUE);
if(m_pClient->m_Snap.m_pGameInfoObj->m_GameStateFlags&GAMESTATEFLAG_GAMEOVER && m_pClient->m_Snap.m_pGameDataObj)
{
char aText[256];
str_copy(aText, Localize("Draw!"), sizeof(aText));
if(m_pClient->m_Snap.m_pGameDataObj->m_TeamscoreRed > m_pClient->m_Snap.m_pGameDataObj->m_TeamscoreBlue)
{
if(pRedClanName)
str_format(aText, sizeof(aText), Localize("%s wins!"), pRedClanName);
else
str_copy(aText, Localize("Red team wins!"), sizeof(aText));
}
else if(m_pClient->m_Snap.m_pGameDataObj->m_TeamscoreBlue > m_pClient->m_Snap.m_pGameDataObj->m_TeamscoreRed)
{
if(pBlueClanName)
str_format(aText, sizeof(aText), Localize("%s wins!"), pBlueClanName);
else
str_copy(aText, Localize("Blue team wins!"), sizeof(aText));
}
float w = TextRender()->TextWidth(0, 86.0f, aText, -1);
TextRender()->Text(0, Width/2-w/2, 39, 86.0f, aText, -1);
}
RenderScoreboard(Width/2-w-5.0f, 150.0f, w, TEAM_RED, pRedClanName ? pRedClanName : Localize("Red team"));
RenderScoreboard(Width/2+5.0f, 150.0f, w, TEAM_BLUE, pBlueClanName ? pBlueClanName : Localize("Blue team"));
}
}
RenderGoals(Width/2-w/2, 150+760+10, w);
RenderSpectators(Width/2-w/2, 150+760+10+50+10, w);
RenderRecordingNotification((Width/7)*4);
}
示例14: Activate
void cStreamdevStreamer::Activate(bool On)
{
if (On && !Active()) {
Dprintf("activate streamer\n");
m_Writer->Start();
cThread::Start();
}
}
示例15: PrepareLua
int CScriptDebugger::PrepareLua(lua_State* l)
{
// call this function immediatly before calling lua_pcall.
//returns index in stack for errorFunc
if(!Active())return -1;
m_nMode = DMOD_NONE;
return m_lua->PrepareLua(l);
}