Permalink
Browse files

added ERCGUtilities.h, fixed scheme for OSX

  • Loading branch information...
1 parent a59934a commit dabcbee839baf127ca2de5769e136cb2cc9903b2 @bkrpub committed Nov 20, 2011
@@ -57,6 +57,7 @@
0473D1F51246BF64004FAD1E /* AboutIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = 0473D1F41246BF64004FAD1E /* AboutIcon.png */; };
0490DD80124D576B0057D874 /* logpoints_default_policy.h in Headers */ = {isa = PBXBuildFile; fileRef = 0490DD7F124D576B0057D874 /* logpoints_default_policy.h */; settings = {ATTRIBUTES = (Public, ); }; };
049299E712D682DB0056392E /* er_symbols.h in Headers */ = {isa = PBXBuildFile; fileRef = 049299E612D682DB0056392E /* er_symbols.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 04A0D8DB1479A7AA00585DD5 /* ERCGUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 04A0D8DA1479A7AA00585DD5 /* ERCGUtilities.h */; };
04AA5A8912D6C09D0097656D /* logpoints.c in Headers */ = {isa = PBXBuildFile; fileRef = 042213FE1200584D0011C415 /* logpoints.c */; settings = {ATTRIBUTES = (Public, ); }; };
04AA5A8A12D6C09D0097656D /* logpoints.m in Headers */ = {isa = PBXBuildFile; fileRef = 042214001200584D0011C415 /* logpoints.m */; settings = {ATTRIBUTES = (Public, ); }; };
04B305641418F5650023AA11 /* NSObject_ERExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 04B305621418F5650023AA11 /* NSObject_ERExtensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -132,6 +133,7 @@
0473D1F41246BF64004FAD1E /* AboutIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = AboutIcon.png; path = ../Resources/AboutIcon.png; sourceTree = SOURCE_ROOT; };
0490DD7F124D576B0057D874 /* logpoints_default_policy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = logpoints_default_policy.h; sourceTree = "<group>"; };
049299E612D682DB0056392E /* er_symbols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = er_symbols.h; sourceTree = "<group>"; };
+ 04A0D8DA1479A7AA00585DD5 /* ERCGUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ERCGUtilities.h; sourceTree = "<group>"; };
04B305621418F5650023AA11 /* NSObject_ERExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSObject_ERExtensions.h; sourceTree = "<group>"; };
04B305631418F5650023AA11 /* NSObject_ERExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSObject_ERExtensions.m; sourceTree = "<group>"; };
04B89F81134BA4760018CC3D /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
@@ -211,6 +213,7 @@
04C5175412FDBF6F00C907EF /* ERUtility */ = {
isa = PBXGroup;
children = (
+ 04A0D8DA1479A7AA00585DD5 /* ERCGUtilities.h */,
044C0BAE134B1DC9006624D8 /* ERColor.h */,
044C0BAF134B1DC9006624D8 /* ERColor.m */,
04DFAD68135CE69500E56F27 /* ERColorTransformer.h */,
@@ -370,6 +373,7 @@
044C0BB0134B1DC9006624D8 /* ERColor.h in Headers */,
044C0BB4134B4FB4006624D8 /* ERValueConverter.h in Headers */,
04DFAD6A135CE69500E56F27 /* ERColorTransformer.h in Headers */,
+ 04A0D8DB1479A7AA00585DD5 /* ERCGUtilities.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -16,7 +16,7 @@
BlueprintIdentifier = "8DC2EF4F0486A6940098B216"
BuildableName = "EngineRoom.framework"
BlueprintName = "EngineRoom-OSX"
- ReferencedContainer = "container:../../../../../../Volumes/_artifacts/vc/EngineRoom/EngineRoom-OSX/EngineRoom-OSX.xcodeproj">
+ ReferencedContainer = "container:EngineRoom-OSX.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@@ -58,6 +58,7 @@
048FE95A14618E2400BC2546 /* logpoints_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 04221556120072700011C415 /* logpoints_types.h */; settings = {ATTRIBUTES = (Public, ); }; };
048FE95B14618E2400BC2546 /* logpoints.h in Headers */ = {isa = PBXBuildFile; fileRef = 04221558120072700011C415 /* logpoints.h */; settings = {ATTRIBUTES = (Public, ); }; };
048FE95C14618E2400BC2546 /* tracer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0422155B120072700011C415 /* tracer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 04A0D8D514799F4400585DD5 /* ERCGUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 04A0D8D414799F4400585DD5 /* ERCGUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
04C5194512FE54EF00C907EF /* ERUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 04C5194012FE54EF00C907EF /* ERUtility.m */; };
AACBBE4A0F95108600F1A2B1 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AACBBE490F95108600F1A2B1 /* Foundation.framework */; };
/* End PBXBuildFile section */
@@ -114,6 +115,7 @@
047DA17F135CF59600B20CDD /* ERValueConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ERValueConverter.m; sourceTree = "<group>"; };
047DA180135CF59600B20CDD /* ERValueTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ERValueTransformer.h; sourceTree = "<group>"; };
047DA181135CF59600B20CDD /* ERValueTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ERValueTransformer.m; sourceTree = "<group>"; };
+ 04A0D8D414799F4400585DD5 /* ERCGUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ERCGUtilities.h; sourceTree = "<group>"; };
04AA591D12D6B8B90097656D /* er_symbols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = er_symbols.h; sourceTree = "<group>"; };
04C5193D12FE546A00C907EF /* Convenience.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Convenience.h; sourceTree = "<group>"; };
04C5193F12FE54EF00C907EF /* ERUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ERUtility.h; sourceTree = "<group>"; };
@@ -217,6 +219,7 @@
047DA181135CF59600B20CDD /* ERValueTransformer.m */,
04C5193F12FE54EF00C907EF /* ERUtility.h */,
04C5194012FE54EF00C907EF /* ERUtility.m */,
+ 04A0D8D414799F4400585DD5 /* ERCGUtilities.h */,
);
path = ERUtility;
sourceTree = "<group>";
@@ -289,6 +292,7 @@
048FE95A14618E2400BC2546 /* logpoints_types.h in Headers */,
048FE95B14618E2400BC2546 /* logpoints.h in Headers */,
048FE95C14618E2400BC2546 /* tracer.h in Headers */,
+ 04A0D8D514799F4400585DD5 /* ERCGUtilities.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -0,0 +1,62 @@
+//
+// ERCGUtilities.h
+// EngineRoom-iOS
+//
+// Created by Bjoern Kriews on 20.11.11.
+// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
+//
+
+#ifndef EngineRoom_iOS_ERCGUtilities_h
+#define EngineRoom_iOS_ERCGUtilities_h
+
+// these CGAffine Utilities were kindly put into the public domain by Jeff LaMarche
+// I like to recommend his blog at http://iphonedevelopment.blogspot.com/
+
+#import <CoreGraphics/CoreGraphics.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ERDegreesToRadian(x) (M_PI * x / 180.0)
+#define ERRadiansToDegrees(x) (180.0 * x / M_PI)
+
+ static inline ERCGAffineTransform CGAffineTransformMakeShear(CGFloat shearX, CGFloat shearY)
+ {
+ return CGAffineTransformMake(1.f, shearY, shearX, 1.f, 0.f, 0.f);
+ }
+ static inline ERCGAffineTransform CGAffineTransformShear(CGAffineTransform transform, CGFloat shearX, CGFloat shearY)
+ {
+ CGAffineTransform sheared = ERCGAffineTransformMakeShear(shearX, shearY);
+ return CGAffineTransformConcat(transform, sheared);
+ }
+ static inline CGFloat ERCGAffineTransformGetDeltaX(CGAffineTransform transform) {return transform.tx;};
+ static inline CGFloat ERCGAffineTransformGetDeltaY(CGAffineTransform transform) {return transform.ty;};
+ static inline CGFloat ERCGAffineTransformGetScaleX(CGAffineTransform transform) {return sqrtf( (transform.a * transform.a) + (transform.c * transform.c) );};
+ static inline CGFloat ERCGAffineTransformGetScaleY(CGAffineTransform transform) {return sqrtf( (transform.b * transform.b) + (transform.d * transform.d) );};
+ static inline CGFloat ERCGAffineTransformGetShearX(CGAffineTransform transform) {return transform.b;};
+ static inline CGFloat ERCGAffineTransformGetShearY(CGAffineTransform transform) {return transform.c;};
+ static inline CGFloat ERCGPointAngleBetweenPoints(CGPoint first, CGPoint second)
+ {
+ CGFloat dy = second.y - first.y;
+ CGFloat dx = second.x - first.x;
+ return atan2f(dy, dx);
+ }
+ static inline CGFloat ERCGAffineTransformGetRotation(CGAffineTransform transform)
+ {
+ // No exact way to get rotation out without knowing order of all previous operations
+ // So, we'll cheat. We'll apply the transformation to two points and then determine the
+ // angle betwen those two points
+
+ CGPoint testPoint1 = CGPointMake(-100.f, 0.f);
+ CGPoint testPoint2 = CGPointMake(100.f, 0.f);
+ CGPoint transformed1 = CGPointApplyAffineTransform(testPoint1, transform);
+ CGPoint transformed2 = CGPointApplyAffineTransform(testPoint2, transform);
+ return ERCGPointAngleBetweenPoints(transformed1, transformed2);
+ }
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

0 comments on commit dabcbee

Please sign in to comment.