# XNA/MonoGame screen scale and keeping aspect

My aim is to make a simple 2D platformer, the idea is that it will be a base resolution of 480x270 (16:9) which can scale x2, x4(1920x1080) or go full screen.

I basically do:

graphics.PreferredBackBufferWidth = 480; graphics.PreferredBackBufferHeight = 270;

and call methods do double or x4 them and then call graphics.ApplyChanges() which work well, I assume any 1x1 pixels from 1x resolution now appear as 2x2 or 4x4.

However in full screen the image is just stretched to whatever fits, how can I make it "letterboxed"?

• You should check out Monogame.Extended on Github! It has several ViewportAdapters that you can use instead of Monogame's default one that have this functionality baked in. github.com/craftworkgames/Monogame.Extended – Pip May 30 '16 at 17:27
• I forgot to mention that I am playing around with that too. I am making a BoxingViewportAdapter which works well windowed but full screen it goes back to square. – lozzajp May 30 '16 at 17:28
• @lozzajp Are you saying you want the BoxingViewportAdapter to be able to have black bars on all sides to keep the image at a perfect 2x / 4x pixel scale? We don't currently have that feature in MonoGame.Extended but I've seen it before and it might be a nice addition. – craftworkgames May 31 '16 at 11:40
• @craftworkgames I think I need to dig deeper and learn more basics then I would love to contribute towards extended. (If you recall my efforts to help with documentation wasn't worth much). For now what exactly is BoxingViewportAdapter suppose to do? From reading the source and docs I find it is suppose to letterbox as I require. It just only works in windowed? – lozzajp May 31 '16 at 15:07
• If it's not working in full screen, that's a bug and we need to fix it. I would appreciate it if you raised an issue with some code. – craftworkgames May 31 '16 at 21:09