Yeah, this is another thread about clipping.
![Tongue :P](https://www.sfml-dev.org/forums/Smileys/default/tongue.gif)
I searched as best as I could but I can't seem to find a solution. I'm not very good at math so I don't doubt what I'm trying to do is really simple, but it's eluded me so far.
Basically, when I resize the window, I want to resize the view so as to fit in the window with proportional scaling, letterboxing when necessary, and center it in the window. That much is done, as you can see in the code below.
What I need to do now is make it so that nothing beyond the extents of the view rect is rendered. I can't figure out how to get the appropriate values for my Viewport.
FP.Width and FP.Height are the dimensions of the screen when it is created.
public void Resize
(int width,
int height
){ _sfmlWindow
.Size = new Vector2u
((uint) width,
(uint) height
); var targetWidth
= (float) width
; var targetHeight
= (float) height
; var scale
= Math
.Min(targetWidth
/ (float) FP
.Width, targetHeight
/ (float) FP
.Height); var toWidth
= width
/ scale
; var toHeight
= height
/ scale
; var x
= (toWidth
- FP
.Width) * -0
.5f
; var y
= (toHeight
- FP
.Height) * -0
.5f
; var viewRect
= new FloatRect
(x, y, toWidth, toHeight
); var view
= new View
(viewRect
); _sfmlWindow
.SetView(view
);}