forked from ericjohnson/canabalt-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Eric Johnson
committed
Dec 30, 2010
0 parents
commit a74cf9a
Showing
468 changed files
with
24,564 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*~ | ||
build | ||
*.pbxuser | ||
*.mode1v3 | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>English</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundleExecutable</key> | ||
<string>${EXECUTABLE_NAME}</string> | ||
<key>CFBundleIconFile</key> | ||
<string>icon.png</string> | ||
<key>CFBundleIconFiles</key> | ||
<array> | ||
<string>icon.png</string> | ||
<string>canabalt_icon_72x72.png</string> | ||
</array> | ||
<key>CFBundleIdentifier</key> | ||
<string>com.semisecretsoftware.${PRODUCT_NAME:rfc1034identifier}</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>${PRODUCT_NAME}</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleSignature</key> | ||
<string>????</string> | ||
<key>CFBundleVersion</key> | ||
<string>1.6</string> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>UIStatusBarHidden</key> | ||
<true/> | ||
<key>UIPrerenderedIcon</key> | ||
<true/> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
</dict> | ||
</plist> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// Canabalt_Prefix.pch | ||
// Canabalt | ||
// | ||
// Copyright Semi Secret Software 2009-2010. All rights reserved. | ||
// | ||
// 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. | ||
// | ||
|
||
// | ||
// Prefix header for all source files of the 'Canabalt' target in the 'Canabalt' project | ||
// | ||
|
||
#import <Availability.h> | ||
|
||
#ifndef __IPHONE_3_0 | ||
#warning "This project uses features only available in iPhone SDK 3.0 and later." | ||
#endif | ||
|
||
#ifdef __OBJC__ | ||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
#import <Flixel/Flixel.h> | ||
#import "UIImage+RIFAddition.h" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// | ||
// CanabaltAppDelegate.h | ||
// Canabalt | ||
// | ||
// Copyright Semi Secret Software 2009-2010. All rights reserved. | ||
// | ||
// 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 <UIKit/UIKit.h> | ||
#import <Flixel/Flixel.h> | ||
|
||
@class Canabalt; | ||
|
||
@interface CanabaltAppDelegate : NSObject <UIApplicationDelegate> | ||
{ | ||
Canabalt * game; | ||
} | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// | ||
// CanabaltAppDelegate.m | ||
// Canabalt | ||
// | ||
// Copyright Semi Secret Software 2009-2010. All rights reserved. | ||
// | ||
// 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 "CanabaltAppDelegate.h" | ||
#import "Canabalt.h" | ||
|
||
#import <SemiSecret/SemiSecretTexture.h> | ||
|
||
void preloadTextureAtlases() | ||
{ | ||
NSDictionary * infoDictionary = nil; | ||
if (FlxG.iPad) | ||
infoDictionary = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], @"iPadTextureAtlas.atlas"]]; | ||
else | ||
infoDictionary = [NSDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], @"textureAtlas.atlas"]]; | ||
|
||
//can only contain NSData, NSDate, NSNumber, NSString, NSArray, and NSDictionary | ||
|
||
NSDictionary * images = [infoDictionary objectForKey:@"images"]; | ||
|
||
for (NSString * image in images) { | ||
NSDictionary * imageInfo = [images objectForKey:image]; | ||
CGRect placement; | ||
placement.origin.x = [[imageInfo objectForKey:@"placement.origin.x"] floatValue]; | ||
placement.origin.y = [[imageInfo objectForKey:@"placement.origin.y"] floatValue]; | ||
placement.size.width = [[imageInfo objectForKey:@"placement.size.width"] floatValue]; | ||
placement.size.height = [[imageInfo objectForKey:@"placement.size.height"] floatValue]; | ||
NSString * atlas = [imageInfo objectForKey:@"atlas"]; | ||
SemiSecretTexture * textureAtlas = [FlxG addTextureWithParam1:atlas param2:NO]; | ||
SemiSecretTexture * texture = [SemiSecretTexture textureWithAtlasTexture:textureAtlas | ||
offset:placement.origin | ||
size:placement.size]; | ||
[FlxG setTexture:texture forKey:image]; | ||
} | ||
|
||
} | ||
|
||
@implementation CanabaltAppDelegate | ||
|
||
|
||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | ||
{ | ||
|
||
//in canabalt, we never want linear filtering (not even on ipad) | ||
[SemiSecretTexture setTextureFilteringMode:SSTextureFilteringNearest]; | ||
|
||
[application setStatusBarOrientation:UIInterfaceOrientationLandscapeRight | ||
animated:NO]; | ||
|
||
game = [[Canabalt alloc] init]; | ||
|
||
//preload textures here, now that opengl stuff should be created | ||
preloadTextureAtlases(); | ||
|
||
return YES; | ||
} | ||
|
||
- (void) applicationDidEnterBackground:(UIApplication *)application | ||
{ | ||
[FlxG didEnterBackground]; | ||
} | ||
|
||
- (void) applicationWillEnterForeground:(UIApplication *)application | ||
{ | ||
[FlxG willEnterForeground]; | ||
} | ||
|
||
- (void) applicationWillResignActive:(UIApplication *)application | ||
{ | ||
[FlxG willResignActive]; | ||
} | ||
|
||
- (void) applicationDidBecomeActive:(UIApplication *)application | ||
{ | ||
[FlxG didBecomeActive]; | ||
} | ||
|
||
- (void) applicationWillTerminate:(UIApplication *)application | ||
{ | ||
} | ||
|
||
- (void) dealloc | ||
{ | ||
[game release]; | ||
[super dealloc]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// UIImage+RIFAddition.h | ||
// Canabalt | ||
// | ||
// Copyright Semi Secret Software 2009-2010. All rights reserved. | ||
// | ||
// 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 <UIKit/UIKit.h> | ||
|
||
@interface UIImage (RIFAddition) | ||
- (id)initWithContentsOfResolutionIndependentFile:(NSString *)path; | ||
+ (UIImage *) imageWithContentsOfResolutionIndependentFile:(NSString *)path; | ||
+ (UIImage *) resolutionIndependentImageNamed:(NSString *)name; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// | ||
// UIImage+RIFAddition.m | ||
// Canabalt | ||
// | ||
// Copyright Semi Secret Software 2009-2010. All rights reserved. | ||
// | ||
// 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 "UIImage+RIFAddition.h" | ||
|
||
@implementation UIImage (RFAddition) | ||
|
||
- (id)initWithContentsOfResolutionIndependentFile:(NSString *)path | ||
{ | ||
BOOL iPad = NO; | ||
if ([UIDevice instancesRespondToSelector:@selector(userInterfaceIdiom)] && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) | ||
iPad = YES; | ||
if ([UIScreen instancesRespondToSelector:@selector(scale)] && [[UIScreen mainScreen] scale] == 2.0) { | ||
// kind of forward thinking, eh? | ||
if (iPad) { | ||
NSString * iPadpath2x = [[path stringByDeletingLastPathComponent] | ||
stringByAppendingPathComponent:[NSString stringWithFormat:@"%@@2x~ipad.%@", | ||
[[path lastPathComponent] stringByDeletingPathExtension], | ||
[path pathExtension]]]; | ||
if ([[NSFileManager defaultManager] fileExistsAtPath:iPadpath2x]) | ||
return [self initWithContentsOfFile:iPadpath2x]; | ||
} | ||
NSString * path2x = [[path stringByDeletingLastPathComponent] | ||
stringByAppendingPathComponent:[NSString stringWithFormat:@"%@@2x.%@", | ||
[[path lastPathComponent] stringByDeletingPathExtension], | ||
[path pathExtension]]]; | ||
if ([[NSFileManager defaultManager] fileExistsAtPath:path2x]) | ||
return [self initWithContentsOfFile:path2x]; | ||
} else if (iPad) { | ||
NSString * iPadpath = [[path stringByDeletingLastPathComponent] | ||
stringByAppendingPathComponent:[NSString stringWithFormat:@"%@~ipad.%@", | ||
[[path lastPathComponent] stringByDeletingPathExtension], | ||
[path pathExtension]]]; | ||
if ( [[NSFileManager defaultManager] fileExistsAtPath:iPadpath] ) | ||
return [self initWithContentsOfFile:iPadpath]; | ||
} | ||
return [self initWithContentsOfFile:path]; | ||
} | ||
|
||
+ (UIImage*)imageWithContentsOfResolutionIndependentFile:(NSString *)path | ||
{ | ||
return [[[UIImage alloc] initWithContentsOfResolutionIndependentFile:path] autorelease]; | ||
} | ||
|
||
+ (UIImage *) resolutionIndependentImageNamed:(NSString *)name | ||
{ | ||
return [self imageWithContentsOfResolutionIndependentFile:[NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] resourcePath], name]]; | ||
} | ||
|
||
@end |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.