1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-26 18:19:24 +01:00
MLEM/MLEM.Extended/Extensions/CameraExtensions.cs

14 lines
453 B
C#
Raw Normal View History

2019-08-07 01:21:32 +02:00
using Microsoft.Xna.Framework;
using MonoGame.Extended;
using Camera = MLEM.Cameras.Camera;
namespace MLEM.Extended.Extensions {
public static class CameraExtensions {
public static RectangleF GetVisibleRectangle(this Camera camera) {
2019-08-07 01:21:32 +02:00
var start = camera.ToWorldPos(Vector2.Zero);
2019-08-07 01:37:14 +02:00
return new RectangleF(start, camera.ToWorldPos(new Vector2(camera.Viewport.Width, camera.Viewport.Height)) - start);
2019-08-07 01:21:32 +02:00
}
}
}