Jump to content
  • Advertisement
Sign in to follow this  

XNA 4 resolution change/scaling problem....

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

Using XNA 4, giving the user the option to change resolutions and it scales the image to fill the window. Slight problem and I don't know exactly where it's at.... After a resolution option is picked, it changes the window size and then scales the image to fill it, if you don't like it, you can click on another option and it repeats it. And here's where my problem shows up....

It works as expected going from 800x600 to 1920x1080 and from 1920x1080 to 1680x1050 and back and back to 800x600, but going from 800x600 to 1680x1050 and back to 800x600, if you click on the left side of the area for 1680x1050, it goes quickly and then back to 800x600, if you do it 3 or 4 times it'll stay at 1680x1050, it works as expected on the right side. When you're at 1680x1050, if you click on the right side but closer to the middle of the area for 800x600, it changes to 800x600, but it flickers like it's doing it more than once....

This is handles through if statements, the width range stays the same, the height range differs, and inside each statement, it's setting the new width and height to variables that are used to calculate a scale based from 800x600....

if(ms.X > 179*scaleWidth & ms.X < 335*scaleWidth & ms.Y > 142*scaleHeight & ms.Y< 167*scaleHeight)
this is repeated for the different resolutions offered with the 142 and 167 increasing by 40 for each repetition.... It's the only thing different between the three I have programmed so far....

and then

I'm lost....

Share this post

Link to post
Share on other sites
so I changed the code some, instead of the if statement checking the X value and the Y value in the same line, it checks the X value and then has if statements for the possible Y values. I added all the resolutions and the statements needed for them. The 800x600 button is in a different location, in it's previous location is 1600x1200, going between 1600x1200 and 1680x1050 doesn't give me a problem, and going between any of the resolutions works as expected, except 1680x1050 when in 800x600.... instead of flickering and having to click numerous times one the left side of the 1680x1050 button, it goes to 1600x1200 but goes to 1680x1050 as expected if you click on the right side of the button.... it's only that button that is giving me problems....

1680x1050 has the area of (179,335) for x and (182, 207) for y....
1600x1200 has x for (179, 335) and y for (222, 247)....

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!