I want to make a game in 320 x 180. But i cant find a way to do it, without the window being 320 x 180, when looking online, some people mention scaling it, but ive got no idea how i would do that. So im wondering if anyone knows how to scale a game in 320 x 180 to 1920 x 1080.
Render all your game into a 320x180 render target, then scale the render target to any size you want
So like mystic river is saying… You can draw your whole game to a scalable canvas, instead of drawing it to the screen… -Once you have your canvas painted, you can treat it as a SINGLE sprite and draw it to the SCREEN, where you can draw to any scale, as you would with any sprite… They are called render targets, because you render images to them as you would render to the screen, same exact thing… One line of code before each BEGIN call in your draw-method to specify what RT to draw to… When you are done drawing to it, you END your sprite-draw routine, switch back to drawing on the screen, and then call a new BEGIN and draw the render target in the place of a sprite texture… Render targets and textures are interchangeable in that regard.
This lets you scale and rotate and color EVERYTHING together, instead of each sprite one by one. Great for cam shake, fitting different screens, etc.
idk if someone will ever use this, bu this is how i solved it
Instead the best way to do this is use Matrix.
Scale is 6 => 1920x1080 / 320x180
Matrix.Indenity
- Matrix.CreateScale(6)
- … whatever else you want the matrix to do.
in your spritebatch.begin(…) call, last line, input the matrix.
Every sprite drawn will do that scale. not only will it work with scaling, but also work with movement, basiclly making a moving camera. You can do your positions as normal, no need to scale based off matrix.
IF you need to get input from an matrix scaled rectangle OR a point in world space that is that scale, etc. Use Vector2.Transform(MousePosition, Matrix.Inverted(matrix))
No need to scale every sprite + positon, makes it easymode.
I hope this can help you.