Line | |
---|
1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using Microsoft.Xna.Framework; |
---|
5 | using Microsoft.Xna.Framework.Content; |
---|
6 | using Microsoft.Xna.Framework.Graphics; |
---|
7 | |
---|
8 | namespace 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.