0

How can i change the resolution and stretch my entire game to the new resolution? I want my game to have a base resolution, and when I change it to stretch to that new resolution. I saw a few similar questions but all the answers suggested that i should change the presentation parameters. If i do that, my screen resolution changes, but all my other objects remain the same size and draw in the wrong position.

I use a LPD3DXSPRITE object to draw the textures to the screen, some DirectX text, and vertices defined as this:

#define D3DFVF_VERTEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)

I tried to put D3DXSPRITE_OBJECTSPACE at sprite->Begin() and play with the projection, view and world matrices but without success.

Can someone tell me if this method is possible and how should I do it? I also read about another method that suggested rendering to a surface, and then stretching the surface, but i don't know how to implement that. I am a beginner in DirectX. I googled the second method, but I couldn't find someone explaining it, and I don't think I can draw from a sprite to a surface.

EDIT:

I managed to do this using the CreateRenderTarget, SetRenderTarget and StretchRect methods, printing to a surface first, and then stretching it on the back buffer.

balauru
  • 55
  • 1
  • 10

2 Answers2

0

You might be able to accomplish this by using DIPs (Device-Independent Pixels or device-independent units) to measure coordinates instead of physical pixels. You also have to mark your game as DPI-aware so that the operating system doesn't scale your UI when you change the resolution. For more information about DPI, see this article.

user1610015
  • 6,561
  • 2
  • 15
  • 18
0

I managed to do this using the CreateRenderTarget, SetRenderTarget and StretchRect methods, printing to a surface first, and then stretching it on the back buffer.

balauru
  • 55
  • 1
  • 10