diff --git a/.gitignore b/.gitignore index 496ee2c..4355fbf 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,8 @@ -.DS_Store \ No newline at end of file +.DS_Store +HMGLTransitions.xcodeproj/project.xcworkspace/contents.xcworkspacedata + +HMGLTransitions.xcodeproj/project.xcworkspace/xcuserdata/kpm.xcuserdatad/UserInterfaceState.xcuserstate + +HMGLTransitions.xcodeproj/xcuserdata/kpm.xcuserdatad/xcschemes/HMGLTransitions.xcscheme + +HMGLTransitions.xcodeproj/xcuserdata/kpm.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/Classes/HMGLTransitions/ClothTransition.h b/Classes/HMGLTransitions/ClothTransition.h index f59b734..64a8265 100644 --- a/Classes/HMGLTransitions/ClothTransition.h +++ b/Classes/HMGLTransitions/ClothTransition.h @@ -21,27 +21,6 @@ #import #import "HMGLTransition.h" -@interface ClothTransition : HMGLTransition { - - CGFloat width; - CGFloat height; - - GLfloat oglWidth; - GLfloat oglHeight; - - float *velocities; - GLfloat *normals; - GLfloat *vertices; - GLfloat *texCoords; - GLushort *indices; - GLsizei indicesCount; - - GLfloat friction; - GLfloat velocityStrength; - - float remainingCalcTime; - - float animationTime; -} +@interface ClothTransition : HMGLTransition @end diff --git a/Classes/HMGLTransitions/ClothTransition.m b/Classes/HMGLTransitions/ClothTransition.m index 5408537..14643fb 100644 --- a/Classes/HMGLTransitions/ClothTransition.m +++ b/Classes/HMGLTransitions/ClothTransition.m @@ -31,6 +31,11 @@ GLfloat x, y, z; } Vector3; +Vector3 substractVectors(Vector3 v1, Vector3 v2); +void addVectors(Vector3 *v1, Vector3 v2); +void multiplyVector(Vector3 *v, GLfloat a); +GLfloat vectorLength(Vector3 v); + Vector3 substractVectors(Vector3 v1, Vector3 v2) { Vector3 r; r.x = v1.x - v2.x; @@ -55,7 +60,29 @@ GLfloat vectorLength(Vector3 v) { return sqrtf(v.x * v.x + v.y * v.y + v.z * v.z); } -@interface ClothTransition() +@interface ClothTransition() { + + CGFloat width; + CGFloat height; + + GLfloat oglWidth; + GLfloat oglHeight; + + float *velocities; + GLfloat *normals; + GLfloat *vertices; + GLfloat *texCoords; + GLushort *indices; + GLsizei indicesCount; + + GLfloat friction; + GLfloat velocityStrength; + + float remainingCalcTime; + + float animationTime; +} + - (void)punchAtPoint:(CGPoint)punchPoint withTime:(NSTimeInterval)frameTime; @@ -500,7 +527,6 @@ - (void)dealloc { free(velocities); free(vertices); free(indices); - [super dealloc]; } @end \ No newline at end of file diff --git a/Classes/HMGLTransitions/CubeTransition.h b/Classes/HMGLTransitions/CubeTransition.h new file mode 100644 index 0000000..fc9acfb --- /dev/null +++ b/Classes/HMGLTransitions/CubeTransition.h @@ -0,0 +1,25 @@ +// +// CubeTransition.h +// HMGLTransitions +// +// Created by Patrick Pietens on 11/14/11. +// Copyright (c) 2011 PatrickPietens.com. All rights reserved. +// + +#import +#import "HMGLTransition.h" + +typedef enum { + CubeTransitionRight, + CubeTransitionLeft +} CubeTransitionType; + +@interface CubeTransition : HMGLTransition +{ + CubeTransitionType transitionType; + GLfloat animationTime; +} + +@property (nonatomic, assign) CubeTransitionType transitionType; + +@end diff --git a/Classes/HMGLTransitions/CubeTransition.m b/Classes/HMGLTransitions/CubeTransition.m new file mode 100644 index 0000000..f23666d --- /dev/null +++ b/Classes/HMGLTransitions/CubeTransition.m @@ -0,0 +1,93 @@ +// +// CubeTransition.m +// HMGLTransitions +// +// Created by Patrick Pietens on 11/14/11. +// Copyright (c) 2011 PatrickPietens.com. All rights reserved. +// + +#import "CubeTransition.h" + +@implementation CubeTransition + +@synthesize transitionType; + +- (id)init +{ + if (self = [super init]) + { + transitionType = CubeTransitionLeft; + } + + return self; +} + + +- (void)initTransition +{ + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustumf(-0.1, 0.1, -0.1, 0.1, 0.1, 100.0); + + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + + glDisable(GL_LIGHTING); + glColor4f(1.0, 1.0, 1.0, 1.0); + + animationTime = 0; +} + + +- (void)drawWithBeginTexture:(GLuint)beginTexture endTexture:(GLuint)endTexture +{ + int myDirection = transitionType == CubeTransitionLeft ? -1 : 1; + + glClearColor(0.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + GLfloat vertices[] = { + -0.5, -0.5, + 0.5, -0.5, + -0.5, 0.5, + 0.5, 0.5, + }; + + glEnable(GL_TEXTURE_2D); + + glVertexPointer(2, GL_FLOAT, 0, vertices); + glEnableClientState(GL_VERTEX_ARRAY); + glTexCoordPointer(2, GL_FLOAT, 0, &basicTexCoords); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glPushMatrix(); + // begin view + glBindTexture(GL_TEXTURE_2D, beginTexture); + glTranslatef(0, 0, -1.0); + glRotatef(myDirection * -90 * sin(animationTime), 0, 1, 0); + glTranslatef(0, 0, 0.5); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glPopMatrix(); + + glPushMatrix(); + // end view + glBindTexture(GL_TEXTURE_2D, endTexture); + glTranslatef(0, 0, -1.0 ); + glRotatef(myDirection * -90 * sin(animationTime), 0, 1, 0); + glTranslatef(myDirection * 0.5, 0.0, 0); + glRotatef(myDirection * 90, 0, 1, 0); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glPopMatrix(); +} + + +- (BOOL)calc:(NSTimeInterval)frameTime +{ + animationTime += M_PI * 0.5 * frameTime * 1.5; + return animationTime > M_PI * 0.5; +} + +@end diff --git a/Classes/HMGLTransitions/DoorsTransition.h b/Classes/HMGLTransitions/DoorsTransition.h index c2f36be..065be94 100644 --- a/Classes/HMGLTransitions/DoorsTransition.h +++ b/Classes/HMGLTransitions/DoorsTransition.h @@ -1,5 +1,8 @@ // Copyright (c) 2010 Hyperbolic Magnetism // +// Modifications for closing doors transition +// Copyright (c) 2011 Karim-Pierre Maalej +// // 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 @@ -26,12 +29,7 @@ typedef enum { DoorsTransitionTypeClose } DoorsTransitionType; -@interface DoorsTransition : HMGLTransition { - - GLfloat animationTime; - - DoorsTransitionType transitionType; -} +@interface DoorsTransition : HMGLTransition @property (nonatomic, assign) DoorsTransitionType transitionType; diff --git a/Classes/HMGLTransitions/DoorsTransition.m b/Classes/HMGLTransitions/DoorsTransition.m index 5923fa0..aff0707 100644 --- a/Classes/HMGLTransitions/DoorsTransition.m +++ b/Classes/HMGLTransitions/DoorsTransition.m @@ -1,5 +1,8 @@ // Copyright (c) 2010 Hyperbolic Magnetism // +// Modifications for closing doors transition +// Copyright (c) 2011 Karim-Pierre Maalej +// // 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 @@ -20,7 +23,9 @@ #import "DoorsTransition.h" -@implementation DoorsTransition +@implementation DoorsTransition { + GLfloat animationTime; +} @synthesize transitionType; @@ -43,17 +48,29 @@ - (void)initTransition { glDisable(GL_LIGHTING); glColor4f(1.0, 1.0, 1.0, 1.0); - animationTime = 0; + animationTime = (transitionType == DoorsTransitionTypeOpen)?0:-2*M_PI/3; } - (void)drawWithBeginTexture:(GLuint)beginTexture endTexture:(GLuint)endTexture { - if (transitionType == DoorsTransitionTypeClose) { - GLuint t = endTexture; - endTexture = beginTexture; - beginTexture = t; - } - + GLuint outerTexture, innerTexture; GLfloat sah, depth; + switch (transitionType) { + case DoorsTransitionTypeOpen: + sah = sin(animationTime * 0.5); + innerTexture = endTexture; + outerTexture = beginTexture; + depth = -1.2 + sah * 0.2; + break; + + case DoorsTransitionTypeClose: + default: + sah = -sin(animationTime * 0.5); + innerTexture = beginTexture; + outerTexture = endTexture; + depth = -1.0 + 0.5 * ( (animationTime < - M_PI_2) ? 0.0 : 1/(animationTime-0.25)-1/(-M_PI_2-0.25) ); + break; + } + glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -66,7 +83,7 @@ - (void)drawWithBeginTexture:(GLuint)beginTexture endTexture:(GLuint)endTexture -w, h, w, h, }; - + GLfloat verticesHalf[] = { -w * 0.5, -h, w * 0.5, -h, @@ -90,14 +107,11 @@ - (void)drawWithBeginTexture:(GLuint)beginTexture endTexture:(GLuint)endTexture glEnable(GL_TEXTURE_2D); - glMatrixMode(GL_MODELVIEW); glLoadIdentity(); - GLfloat sah = sin(animationTime * 0.5); - - GLfloat intensity = sah * sah; - + GLfloat intensity = sah * sah; + // end view glVertexPointer(2, GL_FLOAT, 0, vertices); glEnableClientState(GL_VERTEX_ARRAY); @@ -105,23 +119,29 @@ - (void)drawWithBeginTexture:(GLuint)beginTexture endTexture:(GLuint)endTexture glEnableClientState(GL_TEXTURE_COORD_ARRAY); glPushMatrix(); - glBindTexture(GL_TEXTURE_2D, endTexture); - glTranslatef(0, 0, -1.2 + sah * 0.2); - glColor4f(intensity, intensity, intensity, 1.0); + glBindTexture(GL_TEXTURE_2D, innerTexture); + glTranslatef(0, 0, depth); + if (transitionType == DoorsTransitionTypeOpen) + glColor4f(intensity, intensity, intensity, 1.0); + else + glColor4f(1.0, 1.0, 1.0, 1.0); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glPopMatrix(); - glColor4f(1.0 - intensity, 1.0 - intensity, 1.0 - intensity, 1.0); + if (transitionType == DoorsTransitionTypeOpen) + glColor4f(1.0 - intensity, 1.0 - intensity, 1.0 - intensity, 1.0); // left glPushMatrix(); - glBindTexture(GL_TEXTURE_2D, beginTexture); + glBindTexture(GL_TEXTURE_2D, outerTexture); glVertexPointer(2, GL_FLOAT, 0, verticesHalf); glEnableClientState(GL_VERTEX_ARRAY); glTexCoordPointer(2, GL_FLOAT, 0, texcoords1); glEnableClientState(GL_TEXTURE_COORD_ARRAY); - + glTranslatef(-w, 0, -1); + if (transitionType == DoorsTransitionTypeClose) + glColor4f(1.0-intensity, 1.0-intensity, 1.0-intensity, 1.0); glRotatef(-sah * sah * sah * 90, 0, 1, 0); glTranslatef(w * 0.5, 0, 0); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); @@ -134,6 +154,8 @@ - (void)drawWithBeginTexture:(GLuint)beginTexture endTexture:(GLuint)endTexture glTexCoordPointer(2, GL_FLOAT, 0, texcoords2); glEnableClientState(GL_TEXTURE_COORD_ARRAY); glTranslatef(w, 0, -1); + if (transitionType == DoorsTransitionTypeClose) + glColor4f(1.0-intensity, 1.0-intensity, 1.0-intensity, 1.0); glRotatef(sah * sah * sah * 90, 0, 1, 0); glTranslatef(-w * 0.5, 0, 0); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); @@ -142,15 +164,15 @@ - (void)drawWithBeginTexture:(GLuint)beginTexture endTexture:(GLuint)endTexture - (BOOL)calc:(NSTimeInterval)frameTime { - animationTime += M_PI * frameTime * 1.3; + animationTime += M_PI * frameTime * ((transitionType == DoorsTransitionTypeOpen)?1.3:0.8); + GLfloat endAnimationTime = (transitionType == DoorsTransitionTypeOpen)?M_PI:0; - if (animationTime > M_PI) { - animationTime = M_PI; + if (animationTime > endAnimationTime) { + animationTime = endAnimationTime; return YES; } return NO; - } @end diff --git a/Classes/HMGLTransitions/FlipTransition.h b/Classes/HMGLTransitions/FlipTransition.h index 89c81ce..c593085 100644 --- a/Classes/HMGLTransitions/FlipTransition.h +++ b/Classes/HMGLTransitions/FlipTransition.h @@ -26,12 +26,7 @@ typedef enum { FlipTransitionLeft } FlipTransitionType; -@interface FlipTransition : HMGLTransition { - - FlipTransitionType transitionType; - - GLfloat animationTime; -} +@interface FlipTransition : HMGLTransition @property (nonatomic, assign) FlipTransitionType transitionType; diff --git a/Classes/HMGLTransitions/FlipTransition.m b/Classes/HMGLTransitions/FlipTransition.m index d175cd6..2a97e8d 100644 --- a/Classes/HMGLTransitions/FlipTransition.m +++ b/Classes/HMGLTransitions/FlipTransition.m @@ -21,7 +21,9 @@ #import "FlipTransition.h" -@implementation FlipTransition +@implementation FlipTransition { + GLfloat animationTime; +} @synthesize transitionType; diff --git a/Classes/HMGLTransitions/FoldTransition.h b/Classes/HMGLTransitions/FoldTransition.h new file mode 100644 index 0000000..fce992e --- /dev/null +++ b/Classes/HMGLTransitions/FoldTransition.h @@ -0,0 +1,54 @@ +// +// FoldTransition.h +// HMGLTransitions +// +// Created by John Baker on 3/4/12. +// Copyright (c) 2012 5 to 9 Studio. All rights reserved. +// +// 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: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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. + +#import +#import "HMGLTransition.h" + +typedef enum { + FoldDirectionRight, + FoldDirectionLeft, + FoldDirectionTop, + FoldDirectionBottom, +} FoldDirection; + +typedef enum { + Fold, + Unfold, +} FoldType; + +@interface FoldTransition : HMGLTransition { + + FoldDirection foldDirection; + FoldType foldType; + + int numberOfFolds; + GLfloat animationTime; +} + +@property (nonatomic, assign) int numberOfFolds; +@property (nonatomic, assign) FoldDirection foldDirection; +@property (nonatomic, assign) FoldType foldType; + +@end diff --git a/Classes/HMGLTransitions/FoldTransition.m b/Classes/HMGLTransitions/FoldTransition.m new file mode 100644 index 0000000..bedabb8 --- /dev/null +++ b/Classes/HMGLTransitions/FoldTransition.m @@ -0,0 +1,231 @@ +// +// FoldTransition.m +// HMGLTransitions +// +// Created by John Baker on 3/4/12. +// Copyright (c) 2012 5 to 9 Studio. All rights reserved. +// +// 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: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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. + +#import "FoldTransition.h" + + +@implementation FoldTransition + +@synthesize foldDirection; +@synthesize numberOfFolds; +@synthesize foldType; + +- (id)init { + if (self = [super init]) { + foldDirection = FoldDirectionLeft; + numberOfFolds = 4; + foldType = Fold; + } + return self; +} + +- (void)initTransition { + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustumf(-0.1, 0.1, -0.1, 0.1, 0.1, 100.0); + + glDisable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + + glDisable(GL_LIGHTING); + glColor4f(1.0, 1.0, 1.0, 1.0); + + animationTime = 0; +} + +- (void)drawWithBeginTexture:(GLuint)beginTexture endTexture:(GLuint)endTexture { + glClearColor(0.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + GLfloat vertices[] = { + -1, -1, 0, + 1, -1, 0, + -1, 1, 0, + 1, 1, 0 + }; + + glEnable(GL_TEXTURE_2D); + + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + // end view + glVertexPointer(3, GL_FLOAT, 0, vertices); + glEnableClientState(GL_VERTEX_ARRAY); + glTexCoordPointer(2, GL_FLOAT, 0, &basicTexCoords); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + + glPushMatrix(); + glColor4f(1, 1, 1, 1.0); + glBindTexture(GL_TEXTURE_2D, foldType == Fold ? beginTexture : endTexture); + glTranslatef(0, 0, -1.0); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glPopMatrix(); + + CGFloat fraction = (animationTime / M_PI); + fraction = MAX(MIN(1, fraction), 0); + if(foldType == Unfold) { + fraction = 1-fraction; + } + + CGFloat faceCount = numberOfFolds * 2; + CGFloat faceSize = 2.0/(faceCount); + CGFloat faceSizeFraction = (faceSize)*fraction; + CGFloat faceFractionX = -1.0+(faceSizeFraction); + + if(foldDirection == FoldDirectionLeft) { + for(int i = 0; i < (faceCount); i++) { + GLfloat texcoords[] = { + (basicTexCoords.x0 + ((basicTexCoords.x1 - basicTexCoords.x0) / (faceCount))*i), basicTexCoords.y0, + (basicTexCoords.x0 + ((basicTexCoords.x1 - basicTexCoords.x0) / (faceCount))*(i+1.0)), basicTexCoords.y0, + (basicTexCoords.x2 + ((basicTexCoords.x3 - basicTexCoords.x2) / (faceCount))*i), basicTexCoords.y2, + (basicTexCoords.x2 + ((basicTexCoords.x3 - basicTexCoords.x2) / (faceCount))*(i+1.0)), basicTexCoords.y2, + }; + + bool isLeft = false; + if(i%2==0 ) { + isLeft = true; + } + + if(isLeft) { + + GLfloat verts[] = { + -1.0, -1.0, 0, + faceFractionX , -1.0,-1 * (sqrt(pow((faceSize),2)-pow(((faceFractionX)-(-1.0)),2))), + -1.0, 1.0, 0, + faceFractionX , 1.0,-1 * (sqrt(pow((faceSize),2)-pow(((faceFractionX)-(-1.0)),2))) + }; + + // left + glPushMatrix(); + glBindTexture(GL_TEXTURE_2D, foldType == Fold ? endTexture : beginTexture); + glVertexPointer(3, GL_FLOAT, 0, verts); + glEnableClientState(GL_VERTEX_ARRAY); + glTexCoordPointer(2, GL_FLOAT, 0, texcoords); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glColor4f(fraction, fraction, fraction, 1.0); + glTranslatef((faceSizeFraction)*i, 0, -1.0); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glPopMatrix(); + } + else + { + GLfloat verts[] = { + faceFractionX , -1.0,-1 * ( sqrt(pow((faceSize),2)-pow(((faceFractionX)-(-1.0)),2))), + -1.0+(faceSizeFraction)*2, -1.0, 0, + faceFractionX , 1.0, -1 * (sqrt(pow((faceSize),2)-pow(((faceFractionX)-(-1.0)),2))), + -1.0+(faceSizeFraction)*2, 1.0, 0, + }; + + // left + glPushMatrix(); + glBindTexture(GL_TEXTURE_2D, foldType == Fold ? endTexture : beginTexture); + glVertexPointer(3, GL_FLOAT, 0, verts); + glEnableClientState(GL_VERTEX_ARRAY); + glTexCoordPointer(2, GL_FLOAT, 0, texcoords); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glColor4f(1, 1, 1, 1.0); + + glTranslatef((faceSizeFraction)*(i-1), 0, -1.0); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glPopMatrix(); + } + } + } else if(foldDirection == FoldDirectionRight) { + for(int i = 1; i <= (faceCount); i++) { + GLfloat texcoords[] = { + (basicTexCoords.x0 + ((basicTexCoords.x1 - basicTexCoords.x0) / (faceCount))*((faceCount)-i)), basicTexCoords.y0, + (basicTexCoords.x0 + ((basicTexCoords.x1 - basicTexCoords.x0) / (faceCount))*(((faceCount)-i)+1.0)), basicTexCoords.y0, + (basicTexCoords.x2 + ((basicTexCoords.x3 - basicTexCoords.x2) / (faceCount))*((faceCount)-i)), basicTexCoords.y2, + (basicTexCoords.x2 + ((basicTexCoords.x3 - basicTexCoords.x2) / (faceCount))*(((faceCount)-i)+1.0)), basicTexCoords.y2, + }; + + bool isRight = false; + if(i%2==1 ) { + isRight = true; + } + + if(isRight) { + GLfloat verts[] = { + 0 , -1.0, -1 * (sqrt(pow((faceSize),2)-pow(((faceFractionX)-(-1.0)),2))), + (faceSizeFraction), -1.0, 0, + 0 , 1.0, -1 * (sqrt(pow((faceSize),2)-pow(((faceFractionX)-(-1.0)),2))), + (faceSizeFraction), 1.0, 0, + }; + + glPushMatrix(); + glBindTexture(GL_TEXTURE_2D, foldType == Fold ? endTexture : beginTexture); + glVertexPointer(3, GL_FLOAT, 0, verts); + glEnableClientState(GL_VERTEX_ARRAY); + glTexCoordPointer(2, GL_FLOAT, 0, texcoords); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glColor4f(fraction, fraction, fraction, 1.0); + glTranslatef(1.0-(faceSizeFraction)*i, 0, -1.0); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glPopMatrix(); + glColor4f(1, 1, 1, 1.0); + + } + else + { + GLfloat verts[] = { + 0 , -1.0, 0, + (faceSizeFraction), -1.0, -1 * (sqrt(pow((faceSize),2)-pow(((faceFractionX)-(-1.0)),2))), + 0 , 1.0, 0, + (faceSizeFraction), 1.0, -1 * (sqrt(pow((faceSize),2)-pow(((faceFractionX)-(-1.0)),2))) + }; + + glPushMatrix(); + glBindTexture(GL_TEXTURE_2D, foldType == Fold ? endTexture : beginTexture); + glVertexPointer(3, GL_FLOAT, 0, verts); + glEnableClientState(GL_VERTEX_ARRAY); + glTexCoordPointer(2, GL_FLOAT, 0, texcoords); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glColor4f(1, 1, 1, 1.0); + glTranslatef(1.0-(faceSizeFraction)*i, 0, -1.0); + glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + glPopMatrix(); + } + } + } else if(foldDirection == FoldDirectionTop) { + /* NOT IMPLEMENTED YET */ + } else if(foldDirection == FoldDirectionBottom) { + /* NOT IMPLEMENTED YET */ + } +} + +- (BOOL)calc:(NSTimeInterval)frameTime { + + animationTime += M_PI * frameTime * 1.3; + + if (animationTime > M_PI) { + animationTime = M_PI; + return YES; + } + + return NO; +} + +@end diff --git a/Classes/HMGLTransitions/HMGLTransitionManager.h b/Classes/HMGLTransitions/HMGLTransitionManager.h index 0135e29..4a3b9a1 100644 --- a/Classes/HMGLTransitions/HMGLTransitionManager.h +++ b/Classes/HMGLTransitions/HMGLTransitionManager.h @@ -30,23 +30,7 @@ typedef enum { } HMGLTransitionType; -@interface HMGLTransitionManager : NSObject { - - HMGLTransitionView *transitionView; - - // UIView transitions - UIView *containerView; - - // UIViewController transitions - UIViewController *oldController; - UIViewController *currentController; - - UIImageView *tempOverlayView; - - BOOL animating; - - HMGLTransitionType transitionType; -} +@interface HMGLTransitionManager : NSObject + (HMGLTransitionManager*)sharedTransitionManager; diff --git a/Classes/HMGLTransitions/HMGLTransitionManager.m b/Classes/HMGLTransitions/HMGLTransitionManager.m index fbf0bcc..05f51af 100644 --- a/Classes/HMGLTransitions/HMGLTransitionManager.m +++ b/Classes/HMGLTransitions/HMGLTransitionManager.m @@ -20,13 +20,30 @@ #import "HMGLTransitionManager.h" -@interface HMGLTransitionManager() +@interface HMGLTransitionManager() { + + HMGLTransitionView *transitionView; + + // UIView transitions + UIView *containerView; + + // UIViewController transitions + UIViewController *oldController; + UIViewController *currentController; + + UIImageView *tempOverlayView; + + BOOL animating; + + HMGLTransitionType transitionType; +} -@property (nonatomic, retain) HMGLTransitionView *transitionView; -@property (nonatomic, retain) UIView *containerView; -@property (nonatomic, retain) UIViewController *oldController; -@property (nonatomic, retain) UIViewController *currentController; +@property (nonatomic, strong) HMGLTransitionView *transitionView; +@property (nonatomic, strong) UIView *containerView; + +@property (nonatomic, strong) UIViewController *oldController; +@property (nonatomic, strong) UIViewController *currentController; @end @@ -69,8 +86,7 @@ + (HMGLTransitionManager*)sharedTransitionManager { - (HMGLTransitionView*)transitionView { if (!transitionView) { - self.transitionView = [[[HMGLTransitionView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)] autorelease]; - transitionView.delegate = self; + self.transitionView = [[HMGLTransitionView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)]; } return transitionView; } @@ -126,7 +142,14 @@ - (void)commitTransition { tempOverlayView.frame = containerView.bounds; [containerView insertSubview:tempOverlayView belowSubview:transitionView]; - [transitionView startAnimation]; + [transitionView animateWithCompletionBlock:^{ + // finish transition + [transitionView removeFromSuperview]; + [tempOverlayView removeFromSuperview]; + + // transition type + transitionType = HMGLTransitionTypeNone; + }]; } - (void)switchViewControllers { @@ -166,7 +189,22 @@ - (void)switchViewControllers { tempOverlayView.frame = rect; [oldController.view.superview insertSubview:tempOverlayView belowSubview:transitionView]; - [transitionView startAnimation]; + [transitionView animateWithCompletionBlock:^{ + // finish transition + [transitionView removeFromSuperview]; + [tempOverlayView removeFromSuperview]; + + // view controllers + if (transitionType == HMGLTransitionTypeControllerPresentation) { + [oldController presentModalViewController:currentController animated:NO]; + } + else if (transitionType == HMGLTransitionTypeControllerDismission) { + [oldController dismissModalViewControllerAnimated:NO]; + } + + // transition type + transitionType = HMGLTransitionTypeNone; + }]; } - (void)presentModalViewController:(UIViewController*)modalViewController onViewController:(UIViewController*)viewController { @@ -182,7 +220,7 @@ - (void)dismissModalViewController:(UIViewController*)modalViewController { transitionType = HMGLTransitionTypeControllerDismission; self.oldController = modalViewController; if ([modalViewController respondsToSelector:@selector(presentingViewController)]) { - self.currentController = [modalViewController presentingViewController]; + self.currentController = [modalViewController performSelector:@selector(presentingViewController)]; } else { self.currentController = modalViewController.parentViewController; @@ -190,35 +228,7 @@ - (void)dismissModalViewController:(UIViewController*)modalViewController { [self switchViewControllers]; } -- (void)transitionViewDidFinishTransition:(HMGLTransitionView*)_transitionView { - - // finish transition - [transitionView removeFromSuperview]; - [tempOverlayView removeFromSuperview]; - - // view controllers - if (transitionType == HMGLTransitionTypeControllerPresentation) { - [oldController presentModalViewController:currentController animated:NO]; - } - else if (transitionType == HMGLTransitionTypeControllerDismission) { - [oldController dismissModalViewControllerAnimated:NO]; - } - - // transition type - transitionType = HMGLTransitionTypeNone; -} - #pragma mark - #pragma mark Memory -- (void)dealloc { - [tempOverlayView release]; - [containerView release]; - [transitionView release]; - - [oldController release]; - [currentController release]; - - [super dealloc]; -} @end diff --git a/Classes/HMGLTransitions/HMGLTransitionView.h b/Classes/HMGLTransitions/HMGLTransitionView.h index 5a93d2c..18b60a2 100644 --- a/Classes/HMGLTransitions/HMGLTransitionView.h +++ b/Classes/HMGLTransitions/HMGLTransitionView.h @@ -29,63 +29,18 @@ #import "HMGLTransition.h" -@protocol HMGLTransitionViewDelegate; - // This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass. // The view content is basically an EAGL surface you render your OpenGL scene into. // Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel. -@interface HMGLTransitionView : UIView { - - EAGLContext *context; - - // The pixel dimensions of the CAEAGLLayer - GLint backingWidth; - GLint backingHeight; - - // The OpenGL ES names for the framebuffer and renderbuffer used to render to this view - GLuint defaultFramebuffer, colorRenderbuffer; - GLuint depthRenderbuffer; - - // - BOOL animating; - BOOL displayLinkSupported; - NSInteger animationFrameInterval; - // Use of the CADisplayLink class is the preferred method for controlling your animation timing. - // CADisplayLink will link to the main display and fire every vsync when added to a given run-loop. - // The NSTimer class is used only as fallback when running on a pre 3.1 device where CADisplayLink - // isn't available. - id displayLink; - NSTimer *animationTimer; - - // transition - HMGLTransition *transition; - - // textures - GLuint beginTexture; - GLuint endTexture; - - GLfloat textureWidthNormalized; - GLfloat textureHeightNormalized; - - // frame times - NSTimeInterval lastTime, thisTime, calcTime; - - // delegate - id delegate; - - // frames frame - int framesCount; -} - +@interface HMGLTransitionView : UIView @property (nonatomic, readonly) GLfloat textureWidthNormalized; @property (nonatomic, readonly) GLfloat textureHeightNormalized; @property (readonly, nonatomic, getter=isAnimating) BOOL animating; @property (nonatomic) NSInteger animationFrameInterval; -@property (nonatomic, retain) HMGLTransition *transition; -@property (nonatomic, assign) id delegate; +@property (nonatomic, strong) HMGLTransition *transition; -- (void)startAnimation; +- (void)animateWithCompletionBlock:(void (^)())completionBlock; - (void)stopAnimation; - (void)reset; @@ -95,9 +50,3 @@ @end -@protocol HMGLTransitionViewDelegate - -- (void)transitionViewDidFinishTransition:(HMGLTransitionView*)transitionView; - -@end - diff --git a/Classes/HMGLTransitions/HMGLTransitionView.m b/Classes/HMGLTransitions/HMGLTransitionView.m index 4fdec20..bd037f3 100644 --- a/Classes/HMGLTransitions/HMGLTransitionView.m +++ b/Classes/HMGLTransitions/HMGLTransitionView.m @@ -20,7 +20,47 @@ #import "HMGLTransitionView.h" -@interface HMGLTransitionView() +@interface HMGLTransitionView() { + + EAGLContext *context; + + // The pixel dimensions of the CAEAGLLayer + GLint backingWidth; + GLint backingHeight; + + // The OpenGL ES names for the framebuffer and renderbuffer used to render to this view + GLuint defaultFramebuffer, colorRenderbuffer; + GLuint depthRenderbuffer; + + // + BOOL animating; + BOOL displayLinkSupported; + NSInteger animationFrameInterval; + // Use of the CADisplayLink class is the preferred method for controlling your animation timing. + // CADisplayLink will link to the main display and fire every vsync when added to a given run-loop. + // The NSTimer class is used only as fallback when running on a pre 3.1 device where CADisplayLink + // isn't available. + id displayLink; + NSTimer *animationTimer; + + // transition + HMGLTransition *transition; + + // textures + GLuint beginTexture; + GLuint endTexture; + + GLfloat textureWidthNormalized; + GLfloat textureHeightNormalized; + + // frame times + NSTimeInterval lastTime, thisTime, calcTime; + + // frames frame + int framesCount; +} + +@property(strong) void (^completionBlock)(); - (void)deleteFramebuffer; - (void)setContext:(EAGLContext *)newContext; @@ -36,7 +76,7 @@ @implementation HMGLTransitionView @synthesize animating; @synthesize transition; @dynamic animationFrameInterval; -@synthesize delegate; +@synthesize completionBlock; + (Class)layerClass { return [CAEAGLLayer class]; @@ -48,6 +88,7 @@ - (id)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { self.userInteractionEnabled = YES; self.opaque = YES; + self.completionBlock = nil; // Get the layer CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer; @@ -62,7 +103,6 @@ - (id)initWithFrame:(CGRect)frame { EAGLContext *newContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1]; //} [self setContext:newContext]; - [newContext release]; [self setFramebuffer]; framesCount = 0; @@ -95,8 +135,7 @@ - (void)setContext:(EAGLContext *)newContext { { [self deleteFramebuffer]; - [context release]; - context = [newContext retain]; + context = newContext; [EAGLContext setCurrentContext:nil]; } @@ -378,39 +417,34 @@ - (void)setAnimationFrameInterval:(NSInteger)frameInterval { #pragma mark - #pragma mark Actions + +- (void)animateWithCompletionBlock:(void (^)())block { + if (!animating && transition) { + self.completionBlock = block; + [self startAnimation]; + } +} + + - (void)startAnimation { if (!animating && transition) { - if (displayLinkSupported) { - // CADisplayLink is API new to iPhone SDK 3.1. Compiling against earlier versions will result in a warning, but can be dismissed - // if the system version runtime check for CADisplayLink exists in -initWithCoder:. The runtime check ensures this code will - // not be called in system versions earlier than 3.1. - - displayLink = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget:self selector:@selector(drawView:)]; - [displayLink setFrameInterval:animationFrameInterval]; - [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; - } - else - animationTimer = [NSTimer scheduledTimerWithTimeInterval:(NSTimeInterval)((1.0 / 60.0) * animationFrameInterval) target:self selector:@selector(drawView:) userInfo:nil repeats:TRUE]; - + displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(drawView:)]; + [displayLink setFrameInterval:animationFrameInterval]; + [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; + animating = TRUE; } } - (void)stopAnimation { - if (animating) - { - if (displayLinkSupported) - { - [displayLink invalidate]; - displayLink = nil; - } - else - { - [animationTimer invalidate]; - animationTimer = nil; - } + if (animating) { + [displayLink invalidate]; + displayLink = nil; - [delegate transitionViewDidFinishTransition:self]; + if(self.completionBlock) { + self.completionBlock(); + self.completionBlock = nil; + } animating = FALSE; } @@ -423,17 +457,11 @@ - (void)reset { #pragma mark - #pragma mark Memory + - (void)dealloc { - [self deleteTexture:&beginTexture]; [self deleteTexture:&endTexture]; - [self deleteFramebuffer]; - [context release]; - - [transition release]; - - [super dealloc]; } @end diff --git a/Classes/HMGLTransitions/RotateTransition.h b/Classes/HMGLTransitions/RotateTransition.h index d87fbee..7334225 100644 --- a/Classes/HMGLTransitions/RotateTransition.h +++ b/Classes/HMGLTransitions/RotateTransition.h @@ -21,9 +21,6 @@ #import #import "HMGLTransition.h" -@interface RotateTransition : HMGLTransition { - - GLfloat animationTime; -} +@interface RotateTransition : HMGLTransition @end \ No newline at end of file diff --git a/Classes/HMGLTransitions/RotateTransition.m b/Classes/HMGLTransitions/RotateTransition.m index d2a8734..d886e05 100644 --- a/Classes/HMGLTransitions/RotateTransition.m +++ b/Classes/HMGLTransitions/RotateTransition.m @@ -21,7 +21,9 @@ #import "RotateTransition.h" -@implementation RotateTransition +@implementation RotateTransition { + GLfloat animationTime; +} - (void)initTransition { diff --git a/Classes/HMGLTransitions/Switch3DTransition.h b/Classes/HMGLTransitions/Switch3DTransition.h index 5dc7952..de2638b 100644 --- a/Classes/HMGLTransitions/Switch3DTransition.h +++ b/Classes/HMGLTransitions/Switch3DTransition.h @@ -26,11 +26,7 @@ typedef enum { Switch3DTransitionLeft } Switch3DTransitionType; -@interface Switch3DTransition : HMGLTransition { - - Switch3DTransitionType transitionType; - GLfloat animationTime; -} +@interface Switch3DTransition : HMGLTransition @property (nonatomic, assign) Switch3DTransitionType transitionType; diff --git a/Classes/HMGLTransitions/Switch3DTransition.m b/Classes/HMGLTransitions/Switch3DTransition.m index f226b2c..d481e5c 100644 --- a/Classes/HMGLTransitions/Switch3DTransition.m +++ b/Classes/HMGLTransitions/Switch3DTransition.m @@ -19,7 +19,9 @@ // THE SOFTWARE. #import "Switch3DTransition.h" -@implementation Switch3DTransition +@implementation Switch3DTransition { + GLfloat animationTime; +} @synthesize transitionType; diff --git a/Classes/HMGLTransitionsAppDelegate.h b/Classes/HMGLTransitionsAppDelegate.h index ceb6096..646011c 100644 --- a/Classes/HMGLTransitionsAppDelegate.h +++ b/Classes/HMGLTransitionsAppDelegate.h @@ -25,7 +25,7 @@ UIWindow *window; } -@property (nonatomic, retain) IBOutlet UIWindow *window; +@property (nonatomic, strong) IBOutlet UIWindow *window; @end diff --git a/Classes/HMGLTransitionsAppDelegate.m b/Classes/HMGLTransitionsAppDelegate.m index f583e38..51bf61e 100644 --- a/Classes/HMGLTransitionsAppDelegate.m +++ b/Classes/HMGLTransitionsAppDelegate.m @@ -32,7 +32,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( RootViewController *newViewController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil]; self.window.rootViewController = newViewController; - [newViewController release]; [window makeKeyAndVisible]; @@ -88,11 +87,6 @@ Free up as much memory as possible by purging cached data objects that can be re } -- (void)dealloc { - - [window release]; - [super dealloc]; -} @end diff --git a/Classes/ModalViewController.h b/Classes/ModalViewController.h index 868fd25..6b84640 100644 --- a/Classes/ModalViewController.h +++ b/Classes/ModalViewController.h @@ -22,12 +22,9 @@ @protocol ModalControllerDelegate; -@interface ModalViewController : UIViewController { +@interface ModalViewController : UIViewController - id delegate; -} - -@property (nonatomic, assign) id delegate; +@property (nonatomic, unsafe_unretained) id delegate; - (IBAction)closeButtonPressed; diff --git a/Classes/ModalViewController.m b/Classes/ModalViewController.m index 9352636..9ff1997 100644 --- a/Classes/ModalViewController.m +++ b/Classes/ModalViewController.m @@ -68,9 +68,6 @@ - (void)viewDidUnload { } -- (void)dealloc { - [super dealloc]; -} @end diff --git a/Classes/RootViewController.h b/Classes/RootViewController.h index 3a81e25..2e52a48 100644 --- a/Classes/RootViewController.h +++ b/Classes/RootViewController.h @@ -34,8 +34,8 @@ NSInteger selectedTransitionIdx; } -@property (nonatomic, retain) IBOutlet UIView *view1; -@property (nonatomic, retain) IBOutlet UIView *view2; +@property (nonatomic, strong) IBOutlet UIView *view1; +@property (nonatomic, strong) IBOutlet UIView *view2; - (IBAction)viewTransitionButtonPressed:(id)sender; - (IBAction)modalPresentationButtonPressed:(id)sender; diff --git a/Classes/RootViewController.m b/Classes/RootViewController.m index 411d946..a9ba394 100644 --- a/Classes/RootViewController.m +++ b/Classes/RootViewController.m @@ -25,12 +25,14 @@ #import "RotateTransition.h" #import "ClothTransition.h" #import "DoorsTransition.h" +#import "CubeTransition.h" +#import "FoldTransition.h" #import "ModalViewController.h" @interface RootViewController() -@property (nonatomic, retain) HMGLTransition *transition; +@property (nonatomic, strong) HMGLTransition *transition; @end @@ -47,20 +49,41 @@ @implementation RootViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { - Switch3DTransition *t1 = [[[Switch3DTransition alloc] init] autorelease]; + Switch3DTransition *t1 = [[Switch3DTransition alloc] init]; t1.transitionType = Switch3DTransitionLeft; - FlipTransition *t2 = [[[FlipTransition alloc] init] autorelease]; + FlipTransition *t2 = [[FlipTransition alloc] init]; t2.transitionType = FlipTransitionRight; + + DoorsTransition *t3 = [[DoorsTransition alloc] init]; + t3.transitionType = DoorsTransitionTypeClose; + FoldTransition* tfld1 = [[FoldTransition alloc] init]; + tfld1.foldDirection = FoldDirectionRight; + FoldTransition* tfld2 = [[FoldTransition alloc] init]; + tfld2.foldDirection = FoldDirectionLeft; + + FoldTransition* tufld1 = [[FoldTransition alloc] init]; + tufld1.foldDirection = FoldDirectionRight; + tufld1.foldType = Unfold; + FoldTransition* tufld2 = [[FoldTransition alloc] init]; + tufld2.foldDirection = FoldDirectionLeft; + tufld2.foldType = Unfold; + transitionsArray = [[NSArray alloc] initWithObjects: - [[[Switch3DTransition alloc] init] autorelease], + [[Switch3DTransition alloc] init], t1, - [[[ClothTransition alloc] init] autorelease], - [[[FlipTransition alloc] init] autorelease], + [[ClothTransition alloc] init], + [[FlipTransition alloc] init], t2, - [[[RotateTransition alloc] init] autorelease], - [[[DoorsTransition alloc] init] autorelease], + [[RotateTransition alloc] init], + [[DoorsTransition alloc] init], + t3, + [[CubeTransition alloc] init], + tfld1, + tfld2, + tufld1, + tufld2, nil]; transitionsNamesArray = [[NSArray alloc] initWithObjects: @@ -70,7 +93,13 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil @"Flip left", @"Flip right", @"Rotate", - @"Doors", + @"Opening doors", + @"Closing doors", + @"Cube", + @"Fold Right", + @"Fold Left", + @"Unfold Right", + @"Unfold Left", nil]; @@ -162,7 +191,6 @@ - (IBAction)modalPresentationButtonPressed:(id)sender { [[HMGLTransitionManager sharedTransitionManager] presentModalViewController:newController onViewController:self]; - [newController release]; } #pragma mark - @@ -181,7 +209,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } if ([transitionsArray objectAtIndex:indexPath.row] == transition) { @@ -224,14 +252,5 @@ - (void)viewDidUnload { } -- (void)dealloc { - [transitionsArray release]; - [transition release]; - - [view1 release]; - [view2 release]; - - [super dealloc]; -} @end diff --git a/HMGLTransitions.xcodeproj/project.pbxproj b/HMGLTransitions.xcodeproj/project.pbxproj index 7476f18..7ba6deb 100755 --- a/HMGLTransitions.xcodeproj/project.pbxproj +++ b/HMGLTransitions.xcodeproj/project.pbxproj @@ -15,7 +15,9 @@ 2899E5220DE3E06400AC0155 /* RootViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* RootViewController.xib */; }; 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 28D7ACF80DDB3853001CB0EB /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* RootViewController.m */; }; + 527C27511503E8080052A530 /* FoldTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = 527C27501503E8080052A530 /* FoldTransition.m */; }; 55F884E3142A0B47008F9C14 /* MainWindow~ipad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55F884E2142A0B47008F9C14 /* MainWindow~ipad.xib */; }; + 87B7430C14716AD00019895C /* CubeTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = 87B7430B14716AD00019895C /* CubeTransition.m */; }; AC13782B124ECCD800D21E3F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AC13782A124ECCD800D21E3F /* QuartzCore.framework */; }; AC137831124ECCDC00D21E3F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AC137830124ECCDC00D21E3F /* OpenGLES.framework */; }; AC137845124ECD2B00D21E3F /* HMGLTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = AC13783C124ECD2B00D21E3F /* HMGLTransition.m */; }; @@ -45,11 +47,15 @@ 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 2899E5210DE3E06400AC0155 /* RootViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RootViewController.xib; sourceTree = ""; }; 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; - 28D7ACF60DDB3853001CB0EB /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; path = RootViewController.h; sourceTree = ""; }; + 28D7ACF60DDB3853001CB0EB /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; 28D7ACF70DDB3853001CB0EB /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* HMGLTransitions_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMGLTransitions_Prefix.pch; sourceTree = ""; }; + 527C274F1503E8080052A530 /* FoldTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FoldTransition.h; sourceTree = ""; }; + 527C27501503E8080052A530 /* FoldTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = FoldTransition.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 55F884E2142A0B47008F9C14 /* MainWindow~ipad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "MainWindow~ipad.xib"; sourceTree = ""; }; + 87B7430A14716AD00019895C /* CubeTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CubeTransition.h; sourceTree = ""; }; + 87B7430B14716AD00019895C /* CubeTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CubeTransition.m; sourceTree = ""; }; 8D1107310486CEB800E47090 /* HMGLTransitions-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "HMGLTransitions-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; AC13782A124ECCD800D21E3F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; AC137830124ECCDC00D21E3F /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; @@ -65,7 +71,7 @@ AC137926124ED75E00D21E3F /* FlipTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FlipTransition.m; sourceTree = ""; }; AC169A71124FCD72008F43EA /* RotateTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RotateTransition.h; sourceTree = ""; }; AC169A72124FCD72008F43EA /* RotateTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RotateTransition.m; sourceTree = ""; }; - AC169B0E124FD5FC008F43EA /* ModalViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; path = ModalViewController.h; sourceTree = ""; }; + AC169B0E124FD5FC008F43EA /* ModalViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModalViewController.h; sourceTree = ""; }; AC169B0F124FD5FC008F43EA /* ModalViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ModalViewController.m; sourceTree = ""; }; AC169B10124FD5FC008F43EA /* ModalViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = ModalViewController.xib; path = Classes/ModalViewController.xib; sourceTree = ""; }; AC169B6A124FE159008F43EA /* HMLogo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = HMLogo.png; sourceTree = ""; }; @@ -170,6 +176,8 @@ AC169A74124FCD7C008F43EA /* Transitions */ = { isa = PBXGroup; children = ( + 87B7430A14716AD00019895C /* CubeTransition.h */, + 87B7430B14716AD00019895C /* CubeTransition.m */, AC3E6FA8125264130066AF56 /* DoorsTransition.h */, AC3E6FA9125264130066AF56 /* DoorsTransition.m */, AC169CD4124FF423008F43EA /* ClothTransition.h */, @@ -180,6 +188,8 @@ AC137926124ED75E00D21E3F /* FlipTransition.m */, AC137843124ECD2B00D21E3F /* Switch3DTransition.h */, AC137844124ECD2B00D21E3F /* Switch3DTransition.m */, + 527C274F1503E8080052A530 /* FoldTransition.h */, + 527C27501503E8080052A530 /* FoldTransition.m */, ); name = Transitions; sourceTree = ""; @@ -242,7 +252,7 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0410; + LastUpgradeCheck = 0430; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HMGLTransitions" */; compatibilityVersion = "Xcode 3.2"; @@ -300,6 +310,8 @@ AC169B11124FD5FC008F43EA /* ModalViewController.m in Sources */, AC169CD6124FF423008F43EA /* ClothTransition.m in Sources */, AC3E6FAA125264130066AF56 /* DoorsTransition.m in Sources */, + 87B7430C14716AD00019895C /* CubeTransition.m in Sources */, + 527C27511503E8080052A530 /* FoldTransition.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -311,12 +323,13 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = HMGLTransitions_Prefix.pch; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "HMGLTransitions-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 4.0; PRODUCT_NAME = HMGLTransitions; @@ -330,10 +343,11 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; COPY_PHASE_STRIP = YES; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = HMGLTransitions_Prefix.pch; - GCC_VERSION = com.apple.compilers.llvmgcc42; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; INFOPLIST_FILE = "HMGLTransitions-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 4.0; PRODUCT_NAME = HMGLTransitions; diff --git a/HMGLTransitions.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/HMGLTransitions.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..2cf3dd3 --- /dev/null +++ b/HMGLTransitions.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/HMGLTransitions.xcodeproj/project.xcworkspace/xcuserdata/patrickpietens.xcuserdatad/UserInterfaceState.xcuserstate b/HMGLTransitions.xcodeproj/project.xcworkspace/xcuserdata/patrickpietens.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..bf069fb Binary files /dev/null and b/HMGLTransitions.xcodeproj/project.xcworkspace/xcuserdata/patrickpietens.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/HMGLTransitions.xcodeproj/xcuserdata/patrickpietens.xcuserdatad/xcschemes/HMGLTransitions.xcscheme b/HMGLTransitions.xcodeproj/xcuserdata/patrickpietens.xcuserdatad/xcschemes/HMGLTransitions.xcscheme new file mode 100644 index 0000000..a904029 --- /dev/null +++ b/HMGLTransitions.xcodeproj/xcuserdata/patrickpietens.xcuserdatad/xcschemes/HMGLTransitions.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HMGLTransitions.xcodeproj/xcuserdata/patrickpietens.xcuserdatad/xcschemes/xcschememanagement.plist b/HMGLTransitions.xcodeproj/xcuserdata/patrickpietens.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..0be2b49 --- /dev/null +++ b/HMGLTransitions.xcodeproj/xcuserdata/patrickpietens.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + HMGLTransitions.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 1D6058900D05DD3D006BFB54 + + primary + + + + + diff --git a/main.m b/main.m index a93fee9..3384c72 100644 --- a/main.m +++ b/main.m @@ -21,9 +21,8 @@ #import int main(int argc, char *argv[]) { - - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - int retVal = UIApplicationMain(argc, argv, nil, nil); - [pool release]; - return retVal; + @autoreleasepool { + int retVal = UIApplicationMain(argc, argv, nil, nil); + return retVal; + } }