project_files/HedgewarsMobile/Classes/CGPointUtils.h
changeset 3680 aaf832c6fbd7
parent 3551 d4de36b3801a
child 3996 eb549fd864a5
--- a/project_files/HedgewarsMobile/Classes/CGPointUtils.h	Sat Jul 31 08:19:56 2010 +0200
+++ b/project_files/HedgewarsMobile/Classes/CGPointUtils.h	Sat Jul 31 10:39:20 2010 +0200
@@ -9,12 +9,16 @@
 
 #import <CoreGraphics/CoreGraphics.h>
 
-#define degreesToRadian(x)  (M_PI * x / 180.0)
-#define radiansToDegrees(x) (180.0 * x / M_PI)
+#define degreesToRadians(x) ( M_PI * x / 180.0)
+#define radiansToDegrees(x) (180.0 * x / M_PI )
 
-#define HWX(x) (int)(x-screen.size.height/2)
-#define HWY(x) (int)(screen.size.width-x)
+// 40 is not a good value for iphone but works for ipad
+#define HWX(x) (int)(x-screen.size.height/2)/HW_zoomFactor()
+#define HWY(x) (int)(screen.size.width-x)/HW_zoomFactor() + 40*HW_zoomLevel()/HW_zoomFactor()
+
+#define HWXZ(x) (int)(x-screen.size.height/2)
+#define HWYZ(x) (int)(screen.size.width-x)
 
 CGFloat distanceBetweenPoints (CGPoint first, CGPoint second);
 CGFloat angleBetweenPoints(CGPoint first, CGPoint second);
-CGFloat angleBetweenLines(CGPoint line1Start, CGPoint line1End, CGPoint line2Start, CGPoint lin2End);
+CGFloat angleBetweenLines(CGPoint line1Start, CGPoint line1End, CGPoint line2Start, CGPoint line2End);