Archived

This topic is now archived and is closed to further replies.

Handling resize in windowed mode

This topic is 5151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im working on a sort-of 2d/3d modeller using direct3d8 and mfc. Im having problems when the window gets resized, because my sprites are using RHW inside the fvf, so im specifying pixels as size. When the window gets resized, my sprites change shape, growing and shrinking. What can i do to keep thing from happening? I have a camera class which i used for scrolling, but should i add a member called "scale", and have the sprites use that, and recalculate it when the window is resized? Is there an easier way?

Share this post


Link to post
Share on other sites
When you create the device you specify a backbuffer, when running windowed the same size as the window. Say 400x300.
When you resize it to 500x400 the backbuffer remains 400x300, and the output gets slightly stretched.
What you can do is release all objects (vertex buffers and textures) created with D3DPOOL_DEFAULT, reset the device and restore those objects.
Then of course update your variables that hold window width and height so you can use those for your rwh coordinates.

Share this post


Link to post
Share on other sites