Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Matrix matrix;
- public Vector2 viewport;
- public Vector2 Position
- {
- get
- {
- return position;
- }
- set
- {
- position = value;
- updatematrix();
- }
- }
- public Camera(float width, float height, Scene scene)
- {
- position = Vector2.Zero;
- rotation = 0;
- scale = 1.0f;
- viewport = new Vector2(width, height);
- updatematrix();
- this.scene = scene;
- this.rand = new Random();
- this.width = width;
- this.height = height;
- }
- void updatematrix()
- {
- matrix = Matrix.CreateTranslation(-position.X, -position.Y, 0.0f) *
- Matrix.CreateRotationZ(rotation) *
- Matrix.CreateScale(scale) *
- Matrix.CreateTranslation(viewport.X / 2, viewport.Y / 2, 0.0f);
- }
- public void updateviewport(float width, float height)
- {
- viewport.X = width;
- viewport.Y = height;
- updatematrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement