Sign in to follow this  
Bru

DirectX's viewport resizing screws my buttons.

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) [/code] 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

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