Need help in converting window coordinates
Hello gamers,
I''m going to display a bitmap of a town in my map editor that will be 2000x2000. At any point the user will only be able to see 1/3 of the town. When I place objects on this bitmap I want the the (x,y) position of the object relative to the center of the town which is (0,0) cartesian coordinate system not windows coordinate system. Does any one know a algorithm that can map coordinates relative to the true center of the screen and not the windows coordinates?
Thanks,
Casper
...for over a thousand years the Jedi Knights have been the guardians of peace and justice..before the dark times..before the EmpireCasper..
can''t you just go like (some psuedo code)..
#define CENTERX 2000/2
#define CENTERY 2000/2
and when drawing er whatever..
trueX = object.x + CENTERX;
trueY = object.y + CENTERY;
// then draw at trueX, trueY
-or am i missing something else that you wanna do?-
#define CENTERX 2000/2
#define CENTERY 2000/2
and when drawing er whatever..
trueX = object.x + CENTERX;
trueY = object.y + CENTERY;
// then draw at trueX, trueY
-or am i missing something else that you wanna do?-
-werdup-
is this in 3d? if so, is the bitmap just a big plane?
translate the plane so that it''s center is at 0/0/0, and it''s horizontally positioned. when placing objects, always have y set to zero (assuming y is up). x is side to side, and z is front to back.
if it''s 2d, just add 1000 (half of 2000) to x and y values when doing operations -- as such, -50/-25 (3rd quadrant) from the center would be 950/975 in pixel coordinates, starting from the top left corner of the bitmap.
translate the plane so that it''s center is at 0/0/0, and it''s horizontally positioned. when placing objects, always have y set to zero (assuming y is up). x is side to side, and z is front to back.
if it''s 2d, just add 1000 (half of 2000) to x and y values when doing operations -- as such, -50/-25 (3rd quadrant) from the center would be 950/975 in pixel coordinates, starting from the top left corner of the bitmap.
Creativity is a bloody nuisance and an evil curse that will see to it that you die from stress and alcohol abuse at a very early age, that you piss off all your friends, break appointments, show up late, and have this strange bohemian urge (you know that decadent laid-back pimp-style way of life). The truly creative people I know all live lousy lives, never have time to see you, don't take care of themselves properly, have weird tastes in women and behave badly. They don't wash and they eat disgusting stuff, they are mentally unstable and are absolutely brilliant. (k10k)
you posted while i was writing.
Edited by - revolver on 3/18/00 1:56:08 PM
Edited by - revolver on 3/18/00 1:56:08 PM
Creativity is a bloody nuisance and an evil curse that will see to it that you die from stress and alcohol abuse at a very early age, that you piss off all your friends, break appointments, show up late, and have this strange bohemian urge (you know that decadent laid-back pimp-style way of life). The truly creative people I know all live lousy lives, never have time to see you, don't take care of themselves properly, have weird tastes in women and behave badly. They don't wash and they eat disgusting stuff, they are mentally unstable and are absolutely brilliant. (k10k)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement