Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Matrix Transform(GraphicsDevice graphicsDevice)
- {
- float ViewportWidth = graphicsDevice.Viewport.Width;
- float ViewportHeight = graphicsDevice.Viewport.Height;
- matrixTransform =
- Matrix.CreateTranslation(new Vector3(-cameraPosition.X, -cameraPosition.Y, 0)) *
- Matrix.CreateRotationZ(Rotation) *
- Matrix.CreateScale(new Vector3(Zoom, Zoom, 0)) *
- Matrix.CreateTranslation(
- new Vector3(ViewportWidth * 0.5f, ViewportHeight * 0.5f, 0));
- return matrixTransform;
- }
- //Offsets any cam location by a zoom scaled window bounds
- Vector2 CamCenterOffset
- {
- get { return new Vector2((game.Window.ClientBounds.Height / Zoom)
- * 0.5f, (game.Window.ClientBounds.Width / Zoom) * 0.5f);
- }
- }
- //Scales the mouse.X and mouse.Y by the same Zoom as everything.
- Vector2 MouseCursorInWorld
- {
- get
- {
- currMouseState = Mouse.GetState();
- return cameraPosition + new Vector2(currMouseState.X / Zoom,
- currMouseState.Y / Zoom);
- }
- }
Add Comment
Please, Sign In to add comment