Sign in to follow this  

Issues with resizing window

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

This topic is 2549 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this