source: 2014/30/MikkoI/WindowsGame1/WindowsGame1/WindowsGame1/Camera/Camera.cs @ 5558

Revision 5558, 913 bytes checked in by mijoilmo, 5 years ago (diff)

a

Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using Microsoft.Xna.Framework;
5using Microsoft.Xna.Framework.Content;
6using Microsoft.Xna.Framework.Graphics;
7
8namespace WindowsGame1
9{
10    public class Camera
11    {
12        public Vector2 offset = Vector2.Zero;
13        public float zoomFactor = 1;
14        public float yaw = -45;
15        public Camera() {
16           
17        }
18        public Matrix getMatrix(Vector2 gridSize,Vector2 mapSize) {
19            return Matrix.CreateTranslation(new Vector3(-(gridSize.X * mapSize.X / 2), -(gridSize.Y * mapSize.Y / 2), 0)) *
20                Matrix.CreateRotationZ(MathHelper.ToRadians(45)) *
21                Matrix.CreateRotationX(MathHelper.ToRadians(yaw)) *
22                Matrix.CreateScale(zoomFactor, zoomFactor, 0) *
23                Matrix.CreateTranslation(new Vector3(offset.X, offset.Y, 0));
24        }
25    }
26}
Note: See TracBrowser for help on using the repository browser.