There are essentially three options you can go with when resizing the window:
- Don't do anything and let it get scaled, while the aspect ratio is not being preserved.
- Adjust the the view to keep the ratio intact and fill the unused space either with black bars or some decorative bits.
- Give the player more content for more screen space.
If the game allows it, the third option should always be considered. If the game uses a fixed game space, option 1 or 2 are good.
So if you want to keep the aspect ration, you'll have to adjust the view correctly - see
the tutorial on how to utilize the view. The math behind it, is very simple.