From f4e65a98ca4dd7a1f645b0f131e8783c15d934b5 Mon Sep 17 00:00:00 2001 From: Panajev Date: Mon, 10 Sep 2012 18:13:23 +0200 Subject: [PATCH 1/2] (+): enabled ARC memory management. I used Cocos2D as an external static library to test this. Instructions on how to obtain the complete library package (CocosLib + CocosTools + Utilities), build it, and install it can be found here: https://github.com/Panajev/CocosLib#howto-install --- VRope/VRope.mm | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/VRope/VRope.mm b/VRope/VRope.mm index db9a6f8..952d9b6 100644 --- a/VRope/VRope.mm +++ b/VRope/VRope.mm @@ -152,12 +152,10 @@ -(void)createRope:(CGPoint)pointA pointB:(CGPoint)pointB { VPoint *tmpPoint = [[VPoint alloc] init]; [tmpPoint setPos:tmpVector.x y:tmpVector.y]; [vPoints addObject:tmpPoint]; - [tmpPoint release]; } for(int i=0;i Date: Wed, 3 Oct 2012 18:20:50 +0200 Subject: [PATCH 2/2] (x): added conditional ARC suppor. Brought back old funcgtionality when ARC is disabled. --- VRope/VRope.mm | 84 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 57 insertions(+), 27 deletions(-) diff --git a/VRope/VRope.mm b/VRope/VRope.mm index 952d9b6..277ae45 100644 --- a/VRope/VRope.mm +++ b/VRope/VRope.mm @@ -2,7 +2,7 @@ MIT License. - Copyright (c) 2012 Flightless Ltd. + Copyright (c) 2012 Flightless Ltd. Copyright (c) 2010 Clever Hamster Games. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: @@ -11,7 +11,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ + */ // // VRope.m @@ -102,7 +102,7 @@ -(void)updateWithPreIntegratedGravity:(float)dt { // pre-integrate current gravity CGPoint gravity = ccpMult([VPoint getGravity], dt); - + // update points with pre-integrated gravity [self updateWithPoints:pointA pointB:pointB gxdt:gravity.x gydt:gravity.y]; } @@ -152,10 +152,17 @@ -(void)createRope:(CGPoint)pointA pointB:(CGPoint)pointB { VPoint *tmpPoint = [[VPoint alloc] init]; [tmpPoint setPos:tmpVector.x y:tmpVector.y]; [vPoints addObject:tmpPoint]; + +#if !__has_feature(objc_arc) + [tmpPoint release]; +#endif } for(int i=0;i