[Solved]Scaling/zooming game window?

The problem was exactly what you described here, so that will probably solve your issue :slight_smile:

I wil try it now, but, you are saying that would be better to work with OpenGL instead or DirectX right now?

If you’re not on the latest develop, there’s a bug in DX which will cause the drawing to rescale when the window is resized. I’m not sure if it’s also messed up if you do this through code (with graphicsdevicemanager as I said before).

Thanks Jjagg :slightly_smiling:

I can’t believe this (probably) has been my problem for quite some time now, hopefully I can move on and try get a game off the ground and stop worrying about this meta stuff.

That would explain what happened to me yesterday with reescaling (as you can see here http://gamedev.stackexchange.com/questions/124565/there-are-spritebatch-drawing-limitations-on-monogame?noredirect=1#comment218009_124565 )

EDIT: NOPE; I didn’t say nothing. I’ve tried to port it to OpenGL and happens the same issue as I was having in DirectX. I’m going to try the RenderTarget thing. If I have any issue, I will ask again here. Thanks!

Yeah, if you want to render scaled directly you’d have to account for it in everything position related. Just using an intermediary rendertarget is a lot easier IMO

I’m having more problems with the rectangle than anything hahaha.

The rectangle code = Rectangle _actualScreenRectangle = new Rectangle(0, 0, 160, 144);

Because, if it says I need a vector, I can’t assign the “scaling”. What is happening here.

I have achieved it…somehow.

If I do reescaling, I also need to change the PreferredBackBufferWidth/Height to the new resolution?

Sorry for posting again.

IT WORKS! HAHAHA, thank you all of you! I’ve lost an entire day working on this, and it was really easy.

Haha, thanks again. I only did what Jjagg told me to do. I think this post will help many people like me haha

1 Like

So are you using windows directx or gl?

Did you have to download latest dev build?

I’m using DirectX in this build. And I didn’t need to download the latest dev build, I’m using the last stable release (3.5.1 I think it is?)

Oh but you aren’t resizing your window?

Just drawing to a set render target rectangle size and scaling it up or down.

I’m also resizing my window. If I don’t resize the window, I couldn’t see almost anything on the screen.

Ah but your image is not stretching to fit the screen, it keeps its set size?

I don’t understand you right now. Maybe a picture explanation will help.

I draw on a renderTexture at 160x144, then, depending on the “zoom” variable, it will scale to a certain point.

What happens if you manually resize the window with the mouse?

Also have you attempted full screen in a wide screen desktop resolution? Does the game remain square(ish) or does it just stretch out?

You can’t resize the game. I don’t want to allow that haha.
I haven’t attemped full screen tho.

Lol I know you probably don’t want to allow it, I was just curious what actually happens.

Does your game remain the size you want and just the window grows bigger around it?

Sorry if I sound agresive or something, didn’t want that hahaha.
Yes! Just like you say! If I want the native resolution, the window is 160x144, if I want scalex2, 320x288, and so on.

It’s been a while since I did any monogame development, but looking at an old game I started I came across this, not sure how useful it will be.

http://www.david-amador.com/2010/03/xna-2d-independent-resolution-rendering/