This file contains hidden or 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
// How To Read a File From Your Application Bundle | |
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"MyFile" ofType:@"txt"]; | |
NSData *myData = [NSData dataWithContentsOfFile:filePath]; | |
if (myData) { | |
// do something useful | |
} |
This file contains hidden or 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
// save NSDictionary to plist file | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | |
NSString *documentsDirectory = [paths objectAtIndex:0]; | |
NSString *plistPath = [documentsDirectory stringByAppendingPathComponent:@"myfile.plist"]; | |
NSLog(@"%@", plistPath); | |
[myNSDictionary writeToFile:plistPath atomically: YES]; |
This file contains hidden or 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
NSString *s = @"Some string"; | |
const char *c = [s UTF8String]; |
This file contains hidden or 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
// | |
// Copyright (c) 2009 Mikko Mononen [email protected] | |
// | |
// This software is provided 'as-is', without any express or implied | |
// warranty. In no event will the authors be held liable for any damages | |
// arising from the use of this software. | |
// Permission is granted to anyone to use this software for any purpose, | |
// including commercial applications, and to alter it and redistribute it | |
// freely, subject to the following restrictions: | |
// 1. The origin of this software must not be misrepresented; you must not |
This file contains hidden or 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
// | |
// Copyright (c) 2009 Mikko Mononen [email protected] | |
// | |
// This software is provided 'as-is', without any express or implied | |
// warranty. In no event will the authors be held liable for any damages | |
// arising from the use of this software. | |
// Permission is granted to anyone to use this software for any purpose, | |
// including commercial applications, and to alter it and redistribute it | |
// freely, subject to the following restrictions: | |
// 1. The origin of this software must not be misrepresented; you must not |
This file contains hidden or 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
Project web page http://code.google.com/p/nanosvg/ | |
Overview | |
Nanosvg is simple stupid SVG parser for game prototypes and the likes. It is not meant to be a full fledged SVG parser, but just the bare bones to read the vector data from a SVG file. The parser supports many of the SVG shapes and most of the path commands (except arc). | |
If you're looking for nice and free vector drawing program capable of saving SVG files take a look at Inkscape. | |
Example Usage | |
// Load |
This file contains hidden or 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
-(CGPoint) dispatchTouches:(NSSet *)touches withEvent:(UIEvent *)event | |
{ | |
UITouch* touch = [touches anyObject]; | |
return [[CCDirector sharedDirector] convertToGL:[touch locationInView:[touch view]]]; | |
} |
This file contains hidden or 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
int theInt = 123; | |
// storing value | |
NSValue* valObj; | |
valObj = [NSValue value:&myVal withObjCType:@encode(int*)]; | |
// retrieving value | |
[valObj getValue:&valPtr]; |
This file contains hidden or 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
if ( proxy0->m_clientObject == cylinderBody ) | |
{ | |
return ( proxy1->m_clientObject == cylinderBody ); // cylinder must only collide with cylinder | |
} | |
if ( proxy0->m_clientObject == boxBody ) | |
{ | |
return ( proxy1->m_clientObject == sphereBody ); // box must only collide with sphere | |
} | |
This file contains hidden or 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
import bpy | |
import bge | |
#bge.constraints.setGravity(0, 0, 0); | |
path = bpy.path.abspath("//") | |
filename = bpy.path.display_name_from_filepath(bpy.data.filepath) | |
bge.constraints.exportBulletFile(path+filename+".bullet") |
OlderNewer