public Camera(Game game, InputDefinitions input, WorldHandler worldHandler, Vector2 startPoint) : base(game) { Tile.Zoom = 3; MoveSpeed = 6.25f; this.position = startPoint; this.ViewPort = new Rectangle(position.ToPoint(), new Point(30, 16)); this.input = input; Dir = new Vector2(0, 0); this.world = worldHandler; bounds = new Rectangle(new Vector2(0, 0).ToPoint(), (world.GetSize()).ToPoint()); Zero = Vector2.Zero; }
private void DrawMap(SpriteBatch spriteBatch) { //Draw the worlds map scaled down float scale = 0.5f; Vector2 Position = new Vector2(0, GraphicsDevice.Viewport.Height) - new Vector2(-8, world.GetSize().Y *scale); spriteBatch.Draw(world.getMap(), Position, null, Color.White, 0, Vector2.Zero, scale, SpriteEffects.None, 0); spriteBatch.Draw(CameraView, (cp.camera.Position * scale) + Position, null, Color.White, 0, ZeroVector, (scale / Tile.Zoom), SpriteEffects.None, 0); }