Ignore:
Timestamp:
2011-06-08 12:44:21 (9 years ago)
Author:
tekrjant
Message:

Phew..
Changes:

  • We now have a minimap
  • Camera has been modified
  • Lot of minor stuff
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 2011/23/sijoseha/AdventureGame/AdventureGame/Camera.cs

    r1733 r1749  
    1313        public Matrix Transform { get; set; } 
    1414        public Vector2 Position { get; set; } 
     15        public Viewport View { get; set; } 
     16        public Rectangle Bounds 
     17        { 
     18            get { return new Rectangle((int)Position.X, (int)Position.Y, View.Width, View.Height); } 
     19            set { } 
     20        } 
    1521 
    16         public Camera() 
     22        public Camera(Viewport view) 
    1723        { 
     24            this.View = view; 
    1825            this.Zoom = 1.0f; 
    1926            this.Position = Vector2.Zero; 
     
    2734        public Matrix getTransformation(Viewport viewPort) 
    2835        { 
     36            Zoom = 1.0f; 
    2937            this.Transform = 
    3038                Matrix.CreateTranslation( 
     
    3543        } 
    3644 
     45        public Matrix getTransformation(Viewport viewPort, bool showAll, Vector2 mapSize) 
     46        { 
     47            Zoom = viewPort.Width / (Math.Max(mapSize.X, mapSize.Y) * 32); 
     48            this.Transform = 
     49                //Matrix.CreateTranslation( 
     50                //new Vector3(-this.Position.X, -this.Position.Y, 0)) * 
     51                Matrix.CreateScale(new Vector3(this.Zoom, this.Zoom, 0)) *  
     52            Matrix.CreateTranslation(new Vector3(1.0f, viewPort.Height* 0.5f - mapSize.Y*32*Zoom/2, 0)); 
     53            return this.Transform; 
     54        } 
     55 
    3756        public Vector2 getMouseWorldPos(Vector2 mousePos, Viewport viewPort) 
    3857        { 
     58            Zoom = 1.0f; 
    3959            float MouseWorldX = (mousePos.X - viewPort.Width * 0.5f + (viewPort.Width * 0.5f + this.Position.X) * (float)Math.Pow(this.Zoom, 3)) / 
    4060                  (float)Math.Pow(this.Zoom, 3); 
Note: See TracChangeset for help on using the changeset viewer.