- /// <summary>\r
- /// Get a matrix to transform a point from grid-space to screen coordinates. This\r
- /// method uses the viewport to bound the edges of the map such that the camera\r
- /// will not show anything outside of the grid.\r
- /// </summary>\r
- /// <param name="center">The point to put in the center.</param>\r
- /// <returns>The transformation matrix.</returns>\r
+\r
+ public Point GetPointFromCoordinates(float x, float y)\r
+ {\r
+ Matrix transform = GetTransformation(CenterCell);\r
+ Vector2 point = Vector2.Transform(new Vector2(x, y), transform);\r
+\r
+ return new Point((int)point.X, (int)point.Y);\r
+ }\r
+\r
+ public Rectangle GetRectangleFromCoordinates(float x, float y)\r
+ {\r
+ Matrix transform = GetTransformation(CenterCell);\r
+ Vector2 point = Vector2.Transform(new Vector2(x, y), transform);\r
+ \r
+ return new Rectangle((int)Math.Round(point.X, 0), (int)Math.Round(point.Y, 0), (int)Math.Round(Zoom, 0), (int)Math.Round(Zoom, 0));\r
+ }\r
+\r
+\r
+\r