Exemple #1
0
 void SoundManager::update(float duration)
 {
     if(!mOutput->isInitialized())
         return;
     updateSounds(duration);
     updateRegionSound(duration);
 }
void World::update(sf::Time dt)
{
	// Scroll the world, reset player velocity
	mWorldView.move(0.f, mScrollSpeed * dt.asSeconds() * mScrollSpeedCompensation);	

	FOREACH(Aircraft* a, mPlayerAircrafts)
		a->setVelocity(0.f, 0.f);

	// Setup commands to destroy entities, and guide missiles
	destroyEntitiesOutsideView();
	guideMissiles();

	// Forward commands to scene graph, adapt velocity (scrolling, diagonal correction)
	while (!mCommandQueue.isEmpty())
		mSceneGraph.onCommand(mCommandQueue.pop(), dt);

	adaptPlayerVelocity();

	// Collision detection and response (may destroy entities)
	handleCollisions();

	// Remove aircrafts that were destroyed (World::removeWrecks() only destroys the entities, not the pointers in mPlayerAircraft)
	auto firstToRemove = std::remove_if(mPlayerAircrafts.begin(), mPlayerAircrafts.end(), std::mem_fn(&Aircraft::isMarkedForRemoval));
	mPlayerAircrafts.erase(firstToRemove, mPlayerAircrafts.end());

	// Remove all destroyed entities, create new ones
	mSceneGraph.removeWrecks();
	spawnEnemies();

	// Regular update step, adapt position (correct if outside view)
	mSceneGraph.update(dt, mCommandQueue);
	adaptPlayerPosition();

	updateSounds();
}
void World::update(sf::Time dt)
{
	// Scroll the world, reset player velocity
	mWorldView.move(0.f, mScrollSpeed * dt.asSeconds());	
	mPlayerAircraft->setVelocity(0.f, 0.f);

	// Setup commands to destroy entities, and guide missiles
	destroyEntitiesOutsideView();
	guideMissiles();

	// Forward commands to scene graph, adapt velocity (scrolling, diagonal correction)
	while (!mCommandQueue.isEmpty())
		mSceneGraph.onCommand(mCommandQueue.pop(), dt);
	adaptPlayerVelocity();

	// Collision detection and response (may destroy entities)
	handleCollisions();

	// Remove all destroyed entities, create new ones
	mSceneGraph.removeWrecks();
	spawnEnemies();

	// Regular update step, adapt position (correct if outside view)
	mSceneGraph.update(dt, mCommandQueue);
	adaptPlayerPosition();

	updateSounds();
}
Exemple #4
0
void World::update(sf::Time dt)
{
	/*FOREACH(PlayerBat* a, mPlayerBats)
	a->setVelocity(0.f, 0.f);*/

	// Setup commands to destroy entities
	destroyEntitiesOutsideView();

	// Forward commands to scene graph, adapt velocity (diagonal correction)
	while (!mCommandQueue.isEmpty())
		mSceneGraph.onCommand(mCommandQueue.pop(), dt);

	adaptPlayerVelocity();

	// Collision detection and response (may destroy entities)
	handleCollisions();

	// Remove PlayerBats that were destroyed (World::removeWrecks() only destroys the entities, not the pointers in mPlayerBat)
	auto firstToRemove = std::remove_if(mPlayerBats.begin(), mPlayerBats.end(), std::mem_fn(&PlayerBat::isMarkedForRemoval));
	mPlayerBats.erase(firstToRemove, mPlayerBats.end());

	// Remove all destroyed entities
	mSceneGraph.removeWrecks();

	// Regular update step, adapt position (correct if outside view)
	mSceneGraph.update(dt, mCommandQueue);
	adaptPlayerPosition();

	updateSounds();
}
//----------------------------------------------------------------
bool TestScene2::onUpdate (float fTimeBetweenFrames)
{
    updateCollitions();
    updatePacManInput();
    updateSounds();

    return true;
}
Exemple #6
0
bool AdActor::display() {
	if (_active) {
		updateSounds();
	}

	uint32 alpha;
	if (_alphaColor != 0) {
		alpha = _alphaColor;
	} else {
		alpha = _shadowable ? ((AdGame *)_gameRef)->_scene->getAlphaAt(_posX, _posY, true) : 0xFFFFFFFF;
	}

	float scaleX, scaleY;
	getScale(&scaleX, &scaleY);


	float rotate;
	if (_rotatable) {
		if (_rotateValid) {
			rotate = _rotate;
		} else {
			rotate = ((AdGame *)_gameRef)->_scene->getRotationAt(_posX, _posY) + _relativeRotate;
		}
	} else {
		rotate = 0.0f;
	}

	if (_active) {
		displaySpriteAttachments(true);
	}

	if (_currentSprite && _active) {
		bool reg = _registrable;
		if (_ignoreItems && ((AdGame *)_gameRef)->_selectedItem) {
			reg = false;
		}

		_currentSprite->display(_posX,
		                        _posY,
		                        reg ? _registerAlias : nullptr,
		                        scaleX,
		                        scaleY,
		                        alpha,
		                        rotate,
		                        _blendMode);

	}

	if (_active) {
		displaySpriteAttachments(false);
	}
	if (_active && _partEmitter) {
		_partEmitter->display();
	}


	return STATUS_OK;
}
Exemple #7
0
bool AdEntity::display() {
	if (_active) {
		updateSounds();

		uint32 alpha;
		if (_alphaColor != 0) {
			alpha = _alphaColor;
		} else {
			alpha = _shadowable ? ((AdGame *)_gameRef)->_scene->getAlphaAt(_posX, _posY) : 0xFFFFFFFF;
		}

		float scaleX, scaleY;
		getScale(&scaleX, &scaleY);

		float rotate;
		if (_rotatable) {
			if (_rotateValid) {
				rotate = _rotate;
			} else {
				rotate = ((AdGame *)_gameRef)->_scene->getRotationAt(_posX, _posY) + _relativeRotate;
			}
		} else {
			rotate = 0.0f;
		}


		bool reg = _registrable;
		if (_ignoreItems && ((AdGame *)_gameRef)->_selectedItem) {
			reg = false;
		}

		if (_region && (reg || _editorAlwaysRegister)) {
			_gameRef->_renderer->addRectToList(new BaseActiveRect(_gameRef,  _registerAlias, _region, _gameRef->_offsetX, _gameRef->_offsetY));
		}

		displaySpriteAttachments(true);
		if (_theora && (_theora->isPlaying() || _theora->isPaused())) {
			_theora->display(alpha);
		} else if (_currentSprite) {
			_currentSprite->display(_posX,
			                        _posY,
			                        (reg || _editorAlwaysRegister) ? _registerAlias : nullptr,
			                        scaleX,
			                        scaleY,
			                        alpha,
			                        rotate,
			                        _blendMode);
		}
		displaySpriteAttachments(false);

		if (_partEmitter) {
			_partEmitter->display(_region);
		}

	}
	return STATUS_OK;
}
Exemple #8
0
int render::execute() {
	if (play)
		updateSounds();
	checkBalls();
	draw();
	SDL_GL_SwapWindow(mainwindow);
	if (checkKeys() < 0)
		return -1;
	return 0;
}
    void SoundManager::update(float duration)
    {
        if(!mOutput->isInitialized())
            return;

        if (MWBase::Environment::get().getStateManager()->getState()!=
            MWBase::StateManager::State_NoGame)
        {
            updateSounds(duration);
            updateRegionSound(duration);
        }
    }
void World::update(sf::Time dt)
{
    while(!m_commandQueue.isEmpty())
        m_sceneGraph.onCommand(m_commandQueue.pop(), dt);

    m_sceneGraph.removeWrecks();

    m_physicWorld.Step(dt.asSeconds(), 8, 4);
    m_sceneGraph.update(dt, m_commandQueue);

    updateSounds();
}
void World::update(sf::Time dt)
{
	// Reset player velocity
	mPlayer->setVelocity(0.f, 0.f);

	// Remove useless entities
	destroyEntitiesOutsideView();

	// Update quadtree
	checkForCollision();

	// Update Invaders command: Adapt Movements 
	mInvaders.updateCommand(mCommandQueue);

	// Forward commands to scene graph
	while (!mCommandQueue.isEmpty())
		mSceneGraph.onCommand(mCommandQueue.pop());

	// Update Invasers: Control enemy fires, speed and check end of the game
	mInvaders.update(*mPlayer, mDeadLine, mIsGameEnded, mChangeSpeed);

	// Collision detection and response (may destroy entities)
	handleCollisions();

	// Check if Player Dead
	if (mPlayerFactory.update(dt, mCommandQueue))
		return;

	mBossFactory.update(dt);

	mSceneGraph.removeWrecks();

	updateSpawns();

	// Regular update step
	mSceneGraph.update(dt, mCommandQueue);

	// Adapt position (correct if outside view)
	adaptPlayerPosition();

	updateSounds();
}
Exemple #12
0
void
World::update( sf::Time dt ) {
    mWorldView.move(
        0.0f,
        mScrollSpeed * dt.asSeconds() * mScrollSpeedCompensation
    );

    for ( Aircraft* a : mPlayerAircrafts ) {
        a->SetVelocity( 0.0f, 0.0f );
    }

    destroyEntitiesOutsideView();
    guideMissiles();

    while ( !mCommandQueue.isEmpty() ) {
        mSceneGraph.OnCommand( mCommandQueue.pop(), dt );
    }

    adaptPlayerVelocity();
    handleCollisions();

    // Remove aircrafts that were destroyed
    // (World::removeWrecks() only destroys the entities,
    // not the pointers in mPlayerAircrafts)
    auto firstToRemove = std::remove_if(
        mPlayerAircrafts.begin(),
        mPlayerAircrafts.end(),
        std::mem_fn( &Aircraft::IsMarkedForRemoval )
    );
    mPlayerAircrafts.erase( firstToRemove, mPlayerAircrafts.end() );

    mSceneGraph.RemoveWrecks();
    spawnEnemies();

    mSceneGraph.Update( dt, mCommandQueue );
    adaptPlayerPosition();

    updateSounds();
}
void SoundManager::update()
{
	updateListener();
	updateSounds();
}
Exemple #14
0
void Console::cmdListSounds(const CommandLine &cl) {
	updateSounds();
	printList(_sounds, _maxSizeSounds);
}
Exemple #15
0
void Console::updateCaches() {
	updateVideos();
	updateSounds();
}