public DampedOscillationEffect(Camera camera, float dur, float decay, float mag, float freq) : base(camera, dur) { this.decay = decay; this.mag = mag; this.freq = freq; }
protected override void LoadContent() { batch = new SpriteBatch(GraphicsDevice); colorMaps = new List<Texture2D>(); colorMaps.Add(Content.Load<Texture2D>("Maps/ColorMapCorrect")); colorMaps.Add(Content.Load<Texture2D>("Maps/ColorMap")); colorMaps.Add(Content.Load<Texture2D>("Maps/Midnight")); colorMapIndex = 0; debugFont = Content.Load<SpriteFont>("DebugFont"); Color[] pixelColor = new Color[] { Color.Gray }; pixel1x1 = new Texture2D(GraphicsDevice, 1, 1); pixel1x1.SetData(pixelColor); heightMap = new Map(Content, GraphicsDevice, colorMaps[colorMapIndex], size, size); heightMap.ThreadedGenerateRandomHeight(HeightFunction); input = new Input(); input.AddKeyBinding("quit", Keys.Escape); input.AddKeyBinding("generate", Keys.Space); input.AddKeyBinding("zoom_out", Keys.Q); input.AddKeyBinding("zoom_in", Keys.E); input.AddKeyBinding("pan_up", Keys.W); input.AddKeyBinding("pan_down", Keys.S); input.AddKeyBinding("pan_left", Keys.A); input.AddKeyBinding("pan_right", Keys.D); input.AddKeyBinding("adj_space_up", Keys.Up); input.AddKeyBinding("adj_space_down", Keys.Down); input.AddKeyBinding("cycle_map", Keys.Tab); camera = new Camera(GraphicsDevice.Viewport); cameraPos = new Vector2(size / 2); camera.LockPosition(cameraPos, true); }
/// <summary> /// Applys a rotation effect that oscillates from -mag to +mag and decays over time. /// </summary> /// <param name="camera">The camera the effect is applied to</param> /// <param name="dur">Duration in ms for the effect to occur over</param> /// <param name="decay">Decay coeffecient of the shaking. Use 0 for no decay</param> /// <param name="mag">Maximum magnitude in radians for the camera to rotate</param> /// <param name="freq">Number of times the camera makes a full left -> right -> left pass</param> public CameraShakeEffect(Camera camera, float dur, float decay, float mag, float freq) : base(camera, dur, decay, mag, freq) { magFunction = new DecayFunction(0, 1, decay); oscillateFunction = new OscillatingFunction(0, 1, freq); }
public CameraFlipEffect(Camera camera, float dur, bool flipX, bool flipY) : base(camera, dur) { adjust = -1f; this.flipX = flipX; this.flipY = flipY; SetScale(adjust); }
public virtual void End() { elapsed = dur = 0; camera = null; }
public CameraEffect(Camera camera, float dur) { elapsed = 0; this.camera = camera; this.dur = dur / 1000f; }
/// <summary> /// Copy Constructor /// </summary> /// <param name="camera">The camera to copy</param> public Camera(Camera camera) { dt = camera.dt; mode = camera.mode; oldTarget = camera.oldTarget; target = camera.target; oldTargetPos = camera.oldTargetPos; targetPos = camera.targetPos; transitionPos = camera.transitionPos; transitionRemaining = camera.transitionRemaining; transitionTime = camera.transitionTime; lastFramePos = camera.lastFramePos; effects = new List<CameraEffect>(camera.effects); isTransformDirty = camera.isTransformDirty; transformMatrix = camera.transformMatrix; }