Jump to content

  • Log In with Google      Sign In   
  • Create Account

Image stretching issue


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 kseh   Crossbones+   -  Reputation: 2203

Like
0Likes
Like

Posted 31 May 2012 - 01:03 PM

At the risk of sounding completely out of touch with things, I'm working on windowed game (not full screen) using DirectX7 and C++.

One thing that I had left for quite some time is this issue I have where the graphics that I'm using appear too small on higher resolution screens. So I did some work to allow the window to be sized and to stretch the image to whatever size the user wants and everything worked out fine except for the buttons I have as part of the UI.

Currently, the button is placed onto the main surface I'm working on and then that surface is stretched to the window size. The button stretches with the image but I don't know how to update the co-ordinates I have in the background to recognize if the mouse is on the button and clicking it.

Any suggestions on how to approach this?

Sponsor:

#2 Digitalfragment   Members   -  Reputation: 873

Like
1Likes
Like

Posted 31 May 2012 - 09:33 PM

I'd suggest taking the easiest approach and converting your mouse coordinates to be in the same scale as the screen before resizing.

So, if you have built your UI at say (640,480) but are rendering to a window thats (1024, 768) then convert your mouse x,y like:
((((float)x/1024.0f)*640.0f), (((float)x/768.0f)*480.0f)

#3 kseh   Crossbones+   -  Reputation: 2203

Like
0Likes
Like

Posted 01 June 2012 - 01:11 PM

Thanks Posted Image, it helped knowing that was the right direction to go. It was a ridiculously simple thing that got muddled up between the offsets that I've been using and not thinking clearly about which way the ratio should go. Problem solved.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS