#### Archived

This topic is now archived and is closed to further replies.

# Coordinates irrespective of display mode?

This topic is 5556 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi just wondering... How can i scale some logical coordinates to map on to my display mode. I mean i am working with a logical coordinate system that is always 1000x1000 i.e the point (1000,1000) will always be the bottom right of the screen no matter what the physical display mode is. No i am a little dumb when it comes to scaling values but how could i scale this to a physical value, depending on the actual display mode. For the above point again 1000,1000 would map to 800,600 if the display mode was 800x600 but 1024,768 if the display mode was 1024x768. Any help welcome Thanks.

##### Share on other sites
You could do int actual_x = int(((float)x/1000.0f) * (float)screen_width); All that casting perhaps isn't necessary, but I think it would give you a better result (at the very least, it's more readable). And the same formula should apply to the y axis. Note that this is going to be very slow if you're trying to plot any significant number of coordinates per frame. I've always found it easier to base all my measurements off of the current display size, instead of making a "virtual" display.

Edit - Added some more parentheses.

--------------------

You are not a real programmer until you end all your sentences with semicolons; (c) 2000 ROAD Programming

You are unique. Just like everybody else.

"Mechanical engineers design weapons; civil engineers design targets."
"Sensitivity is adjustable, so you can set it to detect elephants and other small creatures." -- Product Description for a vibration sensor

Yanroy@usa.com

[edited by - Yanroy on August 7, 2003 10:15:09 AM]

[edited by - Yanroy on August 7, 2003 10:15:26 AM]

1. 1
Rutin
46
2. 2
3. 3
4. 4
5. 5
JoeJ
18

• 13
• 10
• 12
• 10
• 13
• ### Forum Statistics

• Total Topics
632998
• Total Posts
3009803
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!