1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-25 17:59:24 +01:00

removed the rectanglef extension since we have our own now

This commit is contained in:
Ellpeck 2019-11-02 14:56:16 +01:00
parent 32c8147a4c
commit 1c8a32b8dc
2 changed files with 6 additions and 14 deletions

View file

@ -1,14 +0,0 @@
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) {
var start = camera.ToWorldPos(Vector2.Zero);
return new RectangleF(start, camera.ToWorldPos(new Vector2(camera.Viewport.Width, camera.Viewport.Height)) - start);
}
}
}

View file

@ -2,6 +2,7 @@ using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MLEM.Extensions;
using MLEM.Misc;
namespace MLEM.Cameras {
public class Camera {
@ -58,6 +59,11 @@ namespace MLEM.Cameras {
return (this.ToWorldPos(Vector2.Zero), this.ToWorldPos(new Vector2(this.Viewport.Width, this.Viewport.Height)));
}
public RectangleF GetVisibleRectangle() {
var start = this.ToWorldPos(Vector2.Zero);
return new RectangleF(start, this.ToWorldPos(new Vector2(this.Viewport.Width, this.Viewport.Height)) - start);
}
public void ConstrainWorldBounds(Vector2 min, Vector2 max) {
if (this.Position.X < min.X)
this.Position.X = min.X;