Beispiel #1
0
Datei: ANIM.CPP Projekt: CGSG/TLR
/* Activate window changing handle function.
 * ARGUMENTS: None.
 * RETURNS: None.
 */
VOID tlr::anim::Activate( VOID )
{
  if (IsActive)
    SetPause(FALSE);
  else
    SetPause(TRUE);
} /* End of 'tlr::anim::Activate' function */
Beispiel #2
0
///////////////////////////////////////////////////////////////////////////////
// Descripcion:
// - Quita la alarma que este instalada, averiguando el tipo de que se trata.
// Parametros:
// - hAlarm. Handle a la alarma a quitar.
// Devuelve:
// - En caso de que se encuentre true. Si no se encontrara (cosa rara) false.
// Notas:
///////////////////////////////////////////////////////////////////////////////
bool
CAlarmManager::UninstallAlarm(const AlarmDefs::AlarmHandle& hAlarm)
{
  // SOLO si instancia inicializada
  ASSERT(IsInitOk());
  // SOLO si parametros validos
  ASSERT(hAlarm);

  // Obtiene el tipo y llama al metodo apropiado
  const AlarmDefs::eAlarmType Type = AlarmDefs::eAlarmType(hAlarm & AlarmDefs::TYPE_MASK);
  bool bResult;
  switch (Type) {	
	case AlarmDefs::TIME_ALARM: {
	  // Alarma de tiempo
	  bResult = UninstallTimeAlarm(hAlarm);
	} break;	  

	case AlarmDefs::WAV_ALARM: {
	  // Alarma de notificacion de la finalizacion de un fichero WAV
	  bResult = UninstallWAVAlarm(hAlarm);
	} break;

	default:
	  ASSERT(false);
  }; // ~ switch

  // ¿Se desinstalo alarma?
  if (bResult) {
	// Se quita el posible modo pausa asociado
	SetPause(hAlarm, false);
  }  

  // Se retorna
  return bResult;
}
Beispiel #3
0
void byoSnake::OnKeyDown(wxKeyEvent& event)
{
    if ( event.GetKeyCode() == 'p' || event.GetKeyCode() == 'P' )
    {
        SetPause(!IsPaused());
        Refresh();
    }

    if ( IsPaused() ) return;

    if ( event.GetKeyCode() == WXK_LEFT )
    {
        m_Direction = dLeft;
        Move();
    }

    if ( event.GetKeyCode() == WXK_RIGHT )
    {
        m_Direction = dRight;
        Move();
    }

    if ( event.GetKeyCode() == WXK_UP )
    {
        m_Direction = dUp;
        Move();
    }

    if ( event.GetKeyCode() == WXK_DOWN )
    {
        m_Direction = dDown;
        Move();
    }
}
Beispiel #4
0
void ImageEx::Destroy()
{
	
	if (m_hThread)
	{
		// If pause un pause
		SetPause(false);

		SetEvent(m_hExitEvent);
		WaitForSingleObject(m_hThread, INFINITE);
	}

	CloseHandle(m_hThread);
	CloseHandle(m_hExitEvent);
	CloseHandle(m_hPause);

	free(m_pPropertyItem);

	m_pPropertyItem = NULL;
	m_hThread = NULL;
	m_hExitEvent = NULL;
	m_hPause = NULL;

	if (m_pStream)
		m_pStream->Release();

}
Beispiel #5
0
//设置倒数时钟,direction为方向,secord为秒数,bNotify是到时是否通知
void CTimerControl::SetTimerUp(int direction,int secord,BOOL bNotify)
{
	m_dwCurrentIndex=direction;
	m_nTimer=secord*2;
	m_bNotify=bNotify;
	SetPause(false);
	ShowTimer(true);
}
//
// AICTPGameGameMode::SetGamePaused
//
void AICTPGameGameMode::SetGamePaused( bool bPaused ) const
{
	auto PlayerOne = GetRobotPlayer( EPlayerID::One );
	if( PlayerOne == nullptr )
	{
		return;
	}

	PlayerOne->SetPause( bPaused );
}
Beispiel #7
0
void StartDemo(void) {
	int x, y, line;
	int tx1 = 0, ty1 = 0, tx2 = 0, ty2 = 0, tx3 = 0, ty3 = 0;
	int px1, py1, px2, py2, px3, py3;
	
	SetPause(16);	// fps ~= 60
	
	CreateSinT();
	
	//					AARRGGBB
	imgClear(Disp, 0xFF000000);		// очищаем экран
	
	while(1) {
		py1 = ty1;
		py2 = ty2;
		py3 = ty3;
	
		for (y = 0; y != Disp.height; y++) {
			line = y * Disp.width;
			px1 = tx1;
			px2 = tx2;
			px3 = tx3;
			
			for (x = 0; x != Disp.width; x++) {
				px1 = px1 + 1;
				px2 = px2 + 1;
				px3 = px3 + 1;
			
				Disp.pBitMap[((x + line) << 2) + 2] = (SinT[px1 & 255] + SinT[py1 & 255]) >> 1;	// R
				Disp.pBitMap[((x + line) << 2) + 1] = (SinT[px2 & 255] + SinT[py2 & 255]) >> 1;	// G
				Disp.pBitMap[((x + line) << 2) + 0] = (SinT[px3 & 255] + SinT[(py3 + 63) & 255]) >> 1;	// B
			}
			py1 = py1 + 1;
			py2 = py2 + 1;
			py3 = py3 + 1;
		}
		tx1 = tx1 + 1;
		ty1 = ty1 + 1;
		tx2 = tx2 + 2;
		ty2 = ty2 + 2;
		tx3 = ty3 + 3;
		ty3 = ty3 + 3;
		
		DrawBuffer(Disp);				// копируем в окно
		Pause();
	}
}
Beispiel #8
0
bool Game::Init( void )
{
	//Profiler::Init();
	//Profiler::Begin("Game");

	Logger::WriteLine( "SYS | Initializing Iris...." );

	InitRenderer( Config::GetMulPath() );

	pCamera.Reset();
	pTextManager = new cTextManager();

	CreateSinTable();

	pDynamicObjectList.Clear();
	pDynamicObjectList.OnAdd( OnAddDynamic );
	pDynamicObjectList.OnDelete( OnDeleteDynamic );

	pCharacterList.Clear();
	pCharacterList.OnAdd( OnAddCharacter );
	pCharacterList.OnDelete( OnDeleteCharacter );

	Logger::WriteLine( "\t| -> loading particles" );
	pParticleLoader.Init( "xml/particles.xml" );

	Logger::WriteLine( "\t| -> renderer" );
	m_kRenderer = new Renderer3D();

	if ( !m_kRenderer->Init() )
	{
		return false;
	}

	SetPosition( Config::GetStartX(), Config::GetStartY(), Config::GetStartZ() );
	SetPause( true );

	m_click_mode = CLICK_NORMAL;

	//Profiler::End();
	//Profiler::Output();

	return true;
}
void FStereoPanoramaManager::PanoramicTogglePause(const TArray<FString>& Args)
{
    auto CapturePlayerController = UGameplayStatics::GetPlayerController(GWorld, 0);
    auto CaptureGameMode = UGameplayStatics::GetGameMode(GWorld);

    if ((CaptureGameMode == nullptr) || (CapturePlayerController == nullptr))
    {
        UE_LOG(LogStereoPanorama, Warning, TEXT("Missing GameMode or PlayerController"));
        return;
    }

    if (GWorld->IsPaused())
    {
        CaptureGameMode->ClearPause();
    }
    else
    {
        CaptureGameMode->SetPause(CapturePlayerController);
    }
}
Beispiel #10
0
bool nGame::InitGame()
{
	// Reset score and health
	SetScore(0);
	SetHealth(100);

	// Reset missle time
	SetMissleTime(GAME_MISSLE_TIME);

	// Add two silos
	AddSilo(nVector2(nGetInstance()->GetGraphics()->GetDisplaySize().cx/3.0f,nGetInstance()->GetGraphics()->GetDisplaySize().cy),GAME_FRENDLY_COLOR);
	AddSilo(nVector2(nGetInstance()->GetGraphics()->GetDisplaySize().cx/1.3f,nGetInstance()->GetGraphics()->GetDisplaySize().cy),GAME_FRENDLY_COLOR);

	// Reset cursor position
	nGetInstance()->GetInput()->GetMouse()->SetPosition(nVector2(nGetInstance()->GetGraphics()->GetDisplaySize().cx / 2,nGetInstance()->GetGraphics()->GetDisplaySize().cy / 2));

	// Start paused
	SetPause(true);

	return true;
}
Beispiel #11
0
void LightManager::TogglePause( TimerTypes eTimer )
{
	SetPause(eTimer, !IsPaused(eTimer));
}
LRESULT CDlgApplication::OnSetPause(WPARAM wParam,LPARAM lParam)
{
	SetPause((BOOL)lParam);

	return 0;
}
Beispiel #13
0
void nGame::Process()
{
	static float absoluteTime = 0.0f;
	static float absoluteTime2 = 0.0f;

	// Check for pause key
	if(nGetInstance()->GetInput()->GetKeyboard()->GetNewKey(DIK_PAUSE) || nGetInstance()->GetInput()->GetKeyboard()->GetNewKey(DIK_P))
		SetPause(!GetPause());

	// Don't process further if paused
	if(m_Pause)
		return;

	absoluteTime += nGetInstance()->GetElapsedTime();
	absoluteTime2 += nGetInstance()->GetElapsedTime();

	// Create enemy missle if enough time passed
	if(absoluteTime > m_MissleTime)
	{
		// Reset the timer
		absoluteTime = 0.0f;
		
		if(m_MissleTime > 1.0f)
			m_MissleTime -= (double)nGetInstance()->GetElapsedTime() / 4.0f;

		// Create a missle at a random top position going to a random bottom position
		AddMissle(nVector2(randf(0.0f,nGetInstance()->GetGraphics()->GetDisplaySize().cx),0.0f),nVector2(randf(0.0f,nGetInstance()->GetGraphics()->GetDisplaySize().cx),nGetInstance()->GetGraphics()->GetDisplaySize().cy),1.0f,80.0f,GAME_ENEMY_COLOR,false,true);
	}

	// Create child enemy missle if enough time passed
	if(absoluteTime2 > 100.0f)
	{
		// Reset the timer
		absoluteTime2 = 0.0f;

		if(m_Missles.size())
		{
			// Create a missle at a random trail of a nother missle
			unsigned long count = 1 + rand() % 3;

			Missle* missle = &m_Missles[rand() % m_Missles.size()];

			// Find a live enemy missle
			while(missle->frendly || missle->dead > 0.0f)
				missle = &m_Missles[rand() % m_Missles.size()];

			nVector2 dir = missle->position - missle->source;
			float length = dir.Length();
			dir.Normalize();

			nVector2 source = missle->source + dir * randf(0.0f,length);

			for(unsigned long i = 0; i < count; i++)
				AddMissle(source,nVector2(randf(0.0f,nGetInstance()->GetGraphics()->GetDisplaySize().cx),nGetInstance()->GetGraphics()->GetDisplaySize().cy),1.0f,80.0f,GAME_ENEMY_COLOR,false,true);
		}
	}

	// Check left missle silo launch
	if(nGetInstance()->GetInput()->GetMouse()->GetNewButton(nMouse::ButtonLeft))
		FireSilo(m_Silos[0],nGetInstance()->GetInput()->GetMouse()->GetPosition(),20.0f,80.0f,true);
	
	// Check right missle silo launch
	if(nGetInstance()->GetInput()->GetMouse()->GetButton(nMouse::ButtonRight))
	{
		// Get a random vector in a sphere domain
		nVector2 miss(randf(-1.0f,1.0f),randf(-1.0f,1.0f));
		miss.Normalize();
		miss *= randf(0.0f,50.0f);

		FireSilo(m_Silos[1],nGetInstance()->GetInput()->GetMouse()->GetPosition() + miss,30.0f,20.0f,false);
	}

	// Remove silo fire time
	for(unsigned long i = 0; i < m_Silos.size(); i++)
	{
		Silo* silo = &m_Silos[i];

		// Remove some fire time
		silo->time -= nGetInstance()->GetElapsedTime();

		// Check if all/too much fire time was removed
		if(silo->time < 0.0f)
			silo->time = 0.0f;
	}

	// Move missles and remove dead ones
	for(unsigned long i = 0; i < m_Missles.size(); i++)
	{
		Missle* missle = &m_Missles[i];

		if(missle->position == missle->destination || missle->dead > 0.0f)
		{
			if(missle->position == missle->destination && !missle->frendly && missle->dead == 0.0f)
			{
				// Players base got hit	
				SetHealth(GetHealth() - 10);

				// Check if player dead
				if(!GetHealth())
				{
					// Game over
					AddHiScore(m_Score);
					RestartGame();

					return;
				}
			}

			if(missle->dead > 10.0f)
			{
				// Remove missle
				RemoveMissle(i--);
				continue;
			}

			if(missle->dead == 0.0f)
			{
				// Explode
				AddExplosion(missle->position,missle->blast,4.0f,nColor(1.0f,0.1f,1.0f));
			}

			missle->dead += nGetInstance()->GetElapsedTime();
			continue;
		}

		if(missle->target > 0.0f)
			missle->target -= nGetInstance()->GetElapsedTime() / 10.0f;
		else if(missle->target < 0.0f)
			missle->target = 0.0f;

		nVector2 velocity = missle->destination - missle->source;
		velocity.Normalize();

		velocity *= missle->speed * nGetInstance()->GetElapsedTime();

		if(velocity.x > 0.0f && missle->position.x + velocity.x > missle->destination.x)
			missle->position.x = missle->destination.x;
		else if(velocity.x < 0.0f && missle->position.x + velocity.x < missle->destination.x)
			missle->position.x = missle->destination.x;
		else
			missle->position.x += velocity.x;

		if(velocity.y > 0.0f && missle->position.y + velocity.y > missle->destination.y)
			missle->position.y = missle->destination.y;
		else if(velocity.y < 0.0f && missle->position.y + velocity.y < missle->destination.y)
			missle->position.y = missle->destination.y;
		else
			missle->position.y += velocity.y;
	}

	// Expand explosions and remove dead ones
	for(unsigned long i = 0; i < m_Explosions.size(); i++)
	{
		Explosion* explosion = &m_Explosions[i];

		if(explosion->size == explosion->power)
		{
			// Remove it
			RemoveExplosion(i--);
			continue;
		}

		float expansion = explosion->speed * nGetInstance()->GetElapsedTime();

		if(explosion->size + expansion > explosion->power)
			explosion->size = explosion->power;
		else
			explosion->size += expansion;

		// Check if the explosion destroyed any missles
		for(unsigned long j = 0; j < m_Missles.size(); j++)
		{
			Missle* missle = &m_Missles[j];

			// Skip frendly or already dead missles
			if(missle->frendly || missle->dead > 0.0f)
				continue;

			nVector2 dir = missle->position - explosion->position;

			unsigned long points = 0;

			if(dir.Length() < explosion->size)
			{
				// Set death time
				missle->dead += nGetInstance()->GetElapsedTime();

				// Create some particles
				for(unsigned long k = 0; k < 50; k++)
				{
					// Get a random vector in a sphere domain
					nVector2 velocity(randf(-1.0f,1.0f),randf(-1.0f,1.0f));
					velocity.Normalize();
					velocity *= randf(0.0f,5.0f);

					AddParticle(missle->position,velocity,nVector2(0.0f,0.1f),10.0f,GAME_COLOR_PARTICLES);
				}

				// Add player points
				points++;
			}

			// Add score
			if(points > 1)
				SetScore(GetScore() + points + points / 2);
			else
				SetScore(GetScore() + points);
		}
	}

	// Move and remove particles
	for(unsigned long i = 0; i < m_Particles.size(); i++)
	{
		Particle* particle = &m_Particles[i];

		// Remove the particle if it's dead
		if(particle->lived >= particle->life)
		{
			// Remove it
			RemoveParticle(i--);
			continue;
		}

		particle->lived += nGetInstance()->GetElapsedTime();

		particle->velocity += particle->force * nGetInstance()->GetElapsedTime();
		particle->position += particle->velocity * nGetInstance()->GetElapsedTime();
	}
}