Geting center position of gtasa map
#3

Quote:
Originally Posted by CodeMatrix
Basically, all I can think of is using some math to figure out the coordinate based on the top left.

If you want the coordinate from the center out, subtract half the SA:MP X-axis to the X-axis value, and add half the SA:MP Y-axis from the Y-axis.

So, the SA:MP map is roughly 6000x6000.
Based on what you have described, the top left of your screen is 0,0. In SA:MP world, this is -3000,3000.
Basically, to make your top left be what it should be, you subtract 3000 from your X-axis value, and add 3000 to your Y-axis value.

As an example, lets say that in your app you have the coordinate 4412,-2316. If you want the SA:MP coordinate, you do this:
Код:
 4412 - 3000 = 1412
-2316 + 3000 = 1316
Giving you the correct SA:MP map position of 1412,1316.

You can easily make a function or two to convert these as needed.

I hope I helped,

CodeMatrix
Wouldnt the bold written be like this:

0,0 on his screen = 6000,0
Reply


Messages In This Thread
Geting center position of gtasa map - by StrickenKid - 29.08.2009, 04:08
Re: Geting center position of gtasa map - by XPlatform - 29.08.2009, 06:22
Re: Geting center position of gtasa map - by [MM]Murphy - 29.08.2009, 12:37
Re: Geting center position of gtasa map - by Westie - 29.08.2009, 13:24
Re: Geting center position of gtasa map - by StrickenKid - 29.08.2009, 15:33
Re: Geting center position of gtasa map - by StrickenKid - 30.08.2009, 04:15
Re: Geting center position of gtasa map - by Westie - 30.08.2009, 08:36
Re: Geting center position of gtasa map - by StrickenKid - 30.08.2009, 14:47
Re: Geting center position of gtasa map - by StrickenKid - 30.08.2009, 15:16
Re: Geting center position of gtasa map - by Redirect Left - 30.08.2009, 23:22

Forum Jump:


Users browsing this thread: 2 Guest(s)