//--------------------------------------------------------------------------------
void    IwSoundTerminate()
{
    IW_CALLSTACK("IwSoundTerminate")

    IwGetSoundManager()->StopAll();

    delete IwGetSoundManager();
}
Beispiel #2
0
void CIwGameAudio::StopAllSounds()
{
	if (!Available)
		return;

	// Stop all audio
	IwGetSoundManager()->PauseAll();
	IwGetSoundManager()->StopAll();
}
Beispiel #3
0
void CIwGameAudio::ResumeAllSounds()
{
	if (!Available)
		return;

	// Resume all sound effects
	IwGetSoundManager()->ResumeAll();
}
Beispiel #4
0
void CIwGameAudio::PauseAllSounds()
{
	if (!Available)
		return;

	// Pause all sound effects
	IwGetSoundManager()->PauseAll();
}
Beispiel #5
0
void CIwGameAudio::Update()
{
	if (!Available)
		return;

	// Update IwSound
	IwGetSoundManager()->Update();
}
Beispiel #6
0
void ResourceManager::update() {
    IwGetSoundManager()->Update();
}
Beispiel #7
0
void Audio::Update()
{
    IwGetSoundManager()->Update();
}
Beispiel #8
0
void Game::mainLoop()
{
    // initialize
    deltaTime = 0;

    // TODO: create a config file and move these there
    const uint64 TARGET_FRAME_MS = 16;
    const uint64 MAX_FRAME_MS = 100;

    // init assets
    AssetFactory::getInstance().init();

		//init resource manager
#ifdef IW_BUILD_RESOURCES
	IwGetResManager()->AddHandler(new CIwResHandlerWAV);
#endif

#ifdef _DEBUG
	IwGetResManager()->LoadGroup("TestLevel.group");
#endif

    // create level
    //LevelManager::getInstance().pushLevel(new MainMenu(this));
    LevelManager::getInstance().pushLevel(new TestLevel());
    LevelManager::getInstance().getActiveLevel()->initialize();

    // init input
    Input::getInstance();
	
	//Init sound and resmanager
	//IwGxInit();
	//Iw2DInit();
	//Iw2DSetAlphaMode(IW_2D_ALPHA_HALF);
	IwSoundInit();
	IwResManagerInit();


	IwGetResManager()->LoadGroup("TestLevel.group");

    // loop
    while( !quit )
    {
        //s3eDeviceYield(0); // S3E applications should yield frequently
        uint64 time = s3eTimerGetMs();

		if ( s3eDeviceCheckQuitRequest() ) {
			quit = true;
		}

		IwGetSoundManager()->Update();
		update();
		render();

        deltaTime = s3eTimerGetMs() - time;
        int yield = 0;

        if (deltaTime < TARGET_FRAME_MS) {
            yield = TARGET_FRAME_MS - deltaTime;
            deltaTime = TARGET_FRAME_MS;
        } else if (deltaTime > MAX_FRAME_MS) {
            deltaTime = MAX_FRAME_MS;
        }

        s3eDeviceYield(yield);
    }

    // clean up
    Input::getInstance().unregister();

	IwSoundTerminate();
	IwResManagerTerminate();
	Iw2DTerminate();
}
Beispiel #9
0
void CGame::Update(int deltaTime)
{
	TutCheckCondition(deltaTime);
	_Character->_CS=idle;
	UpdateInput(deltaTime);
	int btn_id=_UI->IsTouched();
	bool btnYES=false;
	bool btnCancel=false;
	if(btn_id>=0)
	{
		std::cout<<"Touched"<<std::endl;
		_SE->Play(3);
		if(btn_id==BTN_PAUSE&&_GS==GS_Playing)
			_GS=GS_Pause;
		else if(btn_id==BTN_PAUSE&&_GS==GS_Pause)
			_GS=GS_Playing;
		else if(btn_id==BTN_P_RETURN)
			_GS=GS_Playing;
		else if(btn_id==BTN_P_RESTART)
			_GS=GS_Restart;
		else if(btn_id==BTN_E_RESTART)
		{	_GS=GS_Restart;	std::cout<<"E_RS"<<std::endl;}
		else if(btn_id==BTN_E_RETURN)
			_GS=GS_Playing;
		else if(btn_id==BTN_P_MUSIC)
			_GS=GS_Playing;
		else if(btn_id==BTN_P_QUIT)
			_GS=GS_QUIT;
		else if(btn_id==BTN_V_YES)
			btnYES=true;
		else if(btn_id==BTN_V_CANCEL)
			btnCancel=true;
		//current_States=S3E_POINTER_STATE_UP;
	}
	if(_GS==GS_QUIT)//quit to lobby
	{
		_timeLevelCost=0;
		_GS=GS_QU_VERIF;
	}
	if(_GS==GS_Restart)//restart cur level
	{
		_timeLevelCost=0;
		_setEndingText=false;
		_levelFinish=false;
		_GS=GS_RS_VERIF;
	}
	if(_GS==GS_QU_VERIF)
	{
		if(btnYES)
		{
			if(_MapLevel.size()>0&&_currentLevel!=0)
			{
				delete _MapLevel[_MapLevel.size()-1];
				_MapLevel.pop_back();
			}
			_currentLevel=0;
			currentMap=_MapLevel[_currentLevel];

			_Character->Init(currentMap->_StartPos);
			currentMap->SetCharacterIndex(_Character->m_Position);
			currentMap->Init();
			_GS=GS_Playing;
			//current_States=S3E_POINTER_STATE_UP;
		}
		else if(btnCancel)
		{
			_GS=GS_Playing;
		}
	}
	if(_GS==GS_RS_VERIF)
	{
		if(btnYES)
		{
			
			_Character->Init(currentMap->_StartPos);
			currentMap->SetCharacterIndex(_Character->m_Position);
			currentMap->Init();
			_GS=GS_Playing;
			//current_States=S3E_POINTER_STATE_UP;
		}
		else if(btnCancel)
		{
			_GS=GS_Playing;
		}
	}
	if(_GS==GS_Playing)
	{
		OnPlaying(deltaTime);
	}
	
	_Character->Update(deltaTime);
	
	PlayAudio();
	// Update Iw Sound Manager
	IwGetSoundManager()->Update();


	
}