コード例 #1
0
		/// <summary>Construct the logo</summary>
		public XenLogo(UpdateManager updateManager)
		{
			if (updateManager == null)
				throw new ArgumentNullException();

			content = new ContentLoader(Application.GetApplicationInstance().Services);

			this.clearBackground = true;
			
			//setup the system and drawer
			this.particles = new Xen.Ex.Graphics.ParticleSystem(updateManager);
			this.particleDrawer = new VelocityBillboardParticles2DElement(this.particles, false, 0.025f);

			//align it...
			this.particleDrawer.VerticalAlignment = Xen.Ex.Graphics2D.VerticalAlignment.Centre;
			this.particleDrawer.HorizontalAlignment = Xen.Ex.Graphics2D.HorizontalAlignment.Centre;

			//clear background is optional.
			this.clear = new Xen.Graphics.Modifier.ClearBufferModifier(Microsoft.Xna.Framework.Graphics.ClearOptions.Target);
			this.clear.ClearColour = new Microsoft.Xna.Framework.Color();

			//load the data straight from the assembly.
			this.particles.ParticleSystemData = content.Load<Xen.Ex.Graphics.Content.ParticleSystemData>("Logo");
			this.particleTrigger = this.particles.GetTriggerByName("Fire");

			updateManager.Add(this);
		}
コード例 #2
0
		/// <summary>
		/// Draw the logo
		/// </summary>
		public void Draw(DrawState state)
		{
			if (clearBackground)
				this.clear.Draw(state);

			if (EffectFinished)
			{
				if (this.particles != null)
					this.particles.Dispose();
				if (content != null)
					this.content.Dispose();
				this.particleDrawer = null;
				this.particles = null;
				this.particleTrigger = null;
				this.content = null;
			}
			else
			{
				//x axis min/max start range for the particles to spawn in at
				this.particles.GlobalValues[0] = -state.DrawTarget.Size.X / 2;
				this.particles.GlobalValues[1] = 0;

				//y axis min/max start range for the particles to spawn in at
				this.particles.GlobalValues[2] = -state.DrawTarget.Size.Y / 2 - 200;
				this.particles.GlobalValues[3] = +state.DrawTarget.Size.Y / 2 + 200;

				drawingBegun = true;

				if (particles.GetParticleCount(0) > 0)
					particlesCreated = true;

				this.particleDrawer.Draw(state);
			}
		}
コード例 #3
0
		/// <summary>
		/// Dispose the effect resources early. The resources will automatically be disposed when the effect completes.
		/// </summary>
		public void Dispose()
		{
			if (this.particles != null)
				this.particles.Dispose();
			if (content != null)
				this.content.Dispose();

			this.particleDrawer = null;
			this.particles = null;
			this.particleTrigger = null;
			this.content = null;
		}