Jump to content
  • Advertisement
Sign in to follow this  
Bru

DirectX's viewport resizing screws my buttons.

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

i have a minor yet annoying problem. i have a window sized 1280 x 1024. i also have a button class that i made. now since the window got a frame,the viewport gets squeesed a little so that stuff are not exacly displayed where the button click checks are made. if i place the button at location 500,500 then because of the frame,the viewport is scaled down a little bit which means the button's top left corner is not exacly rendered at 500,500 right? if this is the case i could probably fix this by taking the size of the frame into account,but since i dont know the exact size(nor is it the same in every resolution) i cant turn the cordinates of the hit test from full window space to squeesed image space. here,let me give you the code for the hit test to show you the hit test is fine [cpde] if(mousecords.x > x*win_width/1280 && mousecords.x < x*win_width/1280+originalFrame.right && mousecords.y > y*win_height/1024 && mousecords.y < y*win_height/1024+originalFrame.bottom) originalFrame right and bottom represent the width and height of the button. the whole win_width and win_height manipulation and division is to make sure the test works in all resolutions of the window. anyone got any idea how i could fix this problem?

Share this post


Link to post
Share on other sites
Advertisement
oh thanks, that's probably what i need :) now i'll just figure out how to use it in the most effecient way in my game.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!