2D Camera collision with edge of screen (MonoGame Extended)

I’m a bit stuck at getting a camera to do what I’m looking for.

I’m messing around with 2D top-down camera/games, and specifically MonoGame Extended since it has a bunch of helpers for this (though I’m not married to it).

I have set my screen/PreferredBackBuffer to 1600x800 for now, and my OrthographicCamera to a small size so you can only see a portion of the overall screen/map at a time.

var viewportAdapter = new BoxingViewportAdapter(Window, GraphicsDevice, SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2);
_camera = new OrthographicCamera(viewportAdapter);

If my player gets close to any side of the 1600x800 screen the camera will keep going because I’m also using LookAt() to keep the player at the center at all times.

I can’t quite figure out how to:

  1. Stop moving the camera when it bumps into any side of the screen
  2. Also allow the player to keep moving around WITHOUT moving the camera if it is too close to the edge (first example that is coming to mind is the Stardew Valley camera) … thus temporarily breaking my _camera.LookAt(_player.Position) until you move far enough away from the edge again

I’ve gotten kind of close with a really weird chunk of code where the camera WILL stop moving…but then it’s just stuck there if the player moves far enough away from the edge again and I got stuck

Is there a way to do what I’m looking to do with MonoGame Extended?..or if not just making a camera from scratch to do this?

Is “camera collision” with the perimeter of a rectangle a thing? Naturally it can’t just check for intersects because my camera should ALWAYS be INSIDE of/intersecting the screen.

Thanks for any assistance. Let me know if there’s any other details I should provide.