29.08.2009, 06:22
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:
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
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
You can easily make a function or two to convert these as needed.
I hope I helped,
CodeMatrix