/// <summary> /// Create an instance of this game! :) /// </summary> public Pond() { this.IsFixedTimeStep = false; graphics = new GraphicsDeviceManager(this); content = new ContentManager(this.Services); //Oppretter og tar i bruk input-handleren: input = new Input(this); this.Components.Add(input); //Legger til Camera: camera = new FishCam(this, startPosition); this.Components.Add(camera); }
public void Draw(Effect effect, FishCam camera) { // Only draw if there are live particles if (endOfLiveParticlesIndex - endOfDeadParticlesIndex > 0) { // Set HLSL parameters effect.Parameters["WorldViewProjection"].SetValue(camera.View * camera.Projection); // Draw particles foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertexes, endOfDeadParticlesIndex * 3, endOfLiveParticlesIndex - endOfDeadParticlesIndex, ParticleVertex.VertexDeclaration); } } }