Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.Xna.Framework;
- using Microsoft.Xna.Framework.Input;
- using Microsoft.Xna.Framework.Graphics;
- namespace The_Calling
- {
- public class Camera
- {
- public Matrix viewMatrix;
- private Vector2 m_position;
- private Vector2 m_halfViewSize;
- public Camera(Rectangle clientRect)
- {
- m_halfViewSize = new Vector2(clientRect.Width * 0.5f, clientRect.Height * 0.5f);
- UpdateViewMatrix();
- }
- public Vector2 Pos
- {
- get
- {
- return m_position;
- }
- set
- {
- m_position = value;
- UpdateViewMatrix();
- }
- }
- private void UpdateViewMatrix()
- {
- viewMatrix = Matrix.CreateTranslation(m_halfViewSize.X - m_position.X, m_halfViewSize.Y - m_position.Y, 0.0f);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement