/// <summary> /// Event Handler for windows messages /// </summary> private void OnPrivateKeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { keyValues[(int)e.KeyCode] = 0; if (e.KeyCode == System.Windows.Forms.Keys.F1) { shouldDrawHelp = !shouldDrawHelp; } if (e.KeyCode == System.Windows.Forms.Keys.R) { if (canDoALphaBlend) { canDrawReflection = !canDrawReflection; } } if (e.KeyCode == System.Windows.Forms.Keys.C) { animateColor = !animateColor; } if (e.KeyCode == System.Windows.Forms.Keys.F3) { animateEmitter = !animateEmitter; } if (e.KeyCode == System.Windows.Forms.Keys.F4) { if (++particleColor == ParticleColors.NumColors) { particleColor = ParticleColors.White; } } }
/// <summary> /// Called once per frame, the call is the entry point for animating the scene. /// </summary> protected override void FrameMove() { // Slow things down for the REF device if (Caps.DeviceType == DeviceType.Reference) { elapsedTime = 0.05f; } // Determine emitter position Vector3 vEmitterPostion; if (animateEmitter) { vEmitterPostion = new Vector3(3 * (float)Math.Sin(appTime), 0.0f, 3 * (float)Math.Cos(appTime)); } else { vEmitterPostion = new Vector3(0.0f, 0.0f, 0.0f); } if (animateColor) { if (++particleColor == ParticleColors.NumColors) { particleColor = ParticleColors.White; } } // Update particle system particleSystem.Update(elapsedTime, numberParticlesToEmit, g_clrColor[(int)particleColor], g_clrColorFade[(int)particleColor], 8.0f, vEmitterPostion); }