Exemplo n.º 1
0
 public DampedOscillationEffect(Camera camera, float dur, float decay, float mag, float freq)
     : base(camera, dur)
 {
     this.decay = decay;
     this.mag = mag;
     this.freq = freq;
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 /// <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);
 }
Exemplo n.º 4
0
        public CameraFlipEffect(Camera camera, float dur, bool flipX, bool flipY)
            : base(camera, dur)
        {
            adjust = -1f;

            this.flipX = flipX;
            this.flipY = flipY;

            SetScale(adjust);
        }
Exemplo n.º 5
0
 public virtual void End()
 {
     elapsed = dur = 0;
     camera = null;
 }
Exemplo n.º 6
0
 public CameraEffect(Camera camera, float dur)
 {
     elapsed = 0;
     this.camera = camera;
     this.dur = dur / 1000f;
 }
Exemplo n.º 7
0
        /// <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;
        }