Jump to content
  • Advertisement
Sign in to follow this  
Greenbird

Issues with resizing window

This topic is 2856 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

Hey everyone just finished coding a tetris game, everything works but when i resize the window the logic doesn't transfer. I only solved for issues pertaining to a specific sized window. My question is how do i solve for the overall general case i.e. any size window. Im not sure on how to approach this problem any ideas on how to start would be greatly appreciated.

Share this post


Link to post
Share on other sites
Advertisement
You can scale your pieces, so that the the playing area occupies the entire window, and a piece always has the same size as 10% of the window, or how many % is appropriate. The easiest way to do this is to draw to a back-buffer with a specific size and then just scale in the final blit to the window. That way you won't actually have to change anything in the game.
A second option is to add room for more pieces when the window resizes, but that probably won't work very well in the case of Tetris. Another option is to always draw your game the same, and if the window is too large just draw it in the center and draw a background image around it, or similar.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!