Example #1
0
void Radar::Update(const float time_delta) {
	mDirection.Normalize();
	mDirection.Rotate(0.8 * time_delta);
	mRay.SetRotation(- Engine::Vector2D::rad2Deg( mDirection.Rotation() ));

	UpdateAllAttachments(time_delta);
}
void ParticleEmitter::Update(const float time_delta,
							 const Vector2D& position_of_partsys,
							 const Vector2D& direction_of_partsys) {
	mPosition = mPositionOffset + position_of_partsys;
	mDirection = direction_of_partsys;
	mDirection.Rotate(mRotationOffset);

	// Delete particles that have outlived their life time.
	mParticles.erase_if(boost::bind(&Particle::GetLifeTime, _1) >= mTimeToLive);

	mTimeSinceLastParticle += time_delta;
	// Rate is amount of particles sent per second and time_delta is secs.

	while(mTimeSinceLastParticle >= 1.f / mRate) {
		float spread = Math::Random(-mSpread/2, mSpread/2);
		Vector2D spread_vector = mDirection;
		spread_vector.Normalize();
		spread_vector.Rotate(Vector2D::deg2Rad(spread));
		Particle* particle = new Particle(mPosition, spread_vector, mSpeed, mStartColor, mEndColor, mStartAlpha, mEndAlpha, mStartScale, mEndScale, mTimeToLive, mBlendMode, mImageName, mPositionType);
		particle->Initialize();
		mParticles.push_back(particle);
		mTimeSinceLastParticle -= 1.f / mRate;
	}


	BOOST_FOREACH(Particle& particle, mParticles)
		particle.Update(time_delta);

	UpdateAllAttachments(time_delta);
}
Example #3
0
void Entity::Update(float time_delta) {
	UpdateAllAttachments(time_delta);

	if (mUsePhysics) {
		// Move
		btTransform trans;
		mBody->getMotionState()->getWorldTransform(trans);
		btVector3 origin = trans.getOrigin();
		SetPosition(Vector2D(origin.x(), origin.y()));

		btMatrix3x3 rot;
		rot.setIdentity();
		rot = trans.getBasis();
		float fx,fy,fz;
		rot.getEulerZYX(fz,fy,fx);
		SetRotation(PI-fz);
	}
	mWasCollidedLastTick -= 1;
}
Example #4
0
void GuiContainer::Update(float time_delta) {
	UpdateAllAttachments(time_delta);
}
Example #5
0
void GuiControl::Update(const float time_delta) {
	UpdateAllAttachments(time_delta);
}