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
| uint8 *fourchan = (uint8*) malloc(sizeof(uint8) * width * height * 4); | |
| short cur; | |
| short *subscript = (short*) imgData; | |
| for (int i = 0; i < width * height; i++) { | |
| cur = (subscript[i] + 1000) / (int) pow(2., sizeof(short)/2.); | |
| fourchan[i*4] = (uint8) cur; | |
| } |
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
| @interface MyClass () | |
| @property (readwrite, strong) CFMutableSetRef __attribute__((NSObject)) completeContents; | |
| @end | |
| Boolean APIObjectEqual (const void *value1, const void *value2); | |
| Boolean APIObjectEqual (const void *value1, const void *value2) | |
| { |
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
| - (NSArray *)chunkifyWithMaxSize:(NSUInteger)size | |
| { | |
| NSArray *r; | |
| NSUInteger c = [self count]; | |
| NSUInteger numFullChunks = / size; | |
| NSUInteger lastChunkPosition = size * numFullChunks; | |
| @autoreleasepool | |
| { | |
| NSMutableArray *result = [[NSMutableArray alloc] initWithCapacity:numFullChunks + 1]; | |
| for (NSUInteger chunk = 0; chunk < numFullChunks; chunk++) |
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
| @interface MyClass : NSObject | |
| @property (readwrite, copy) NSArray *someArray; | |
| @end | |
| @implementation MyClass | |
| { | |
| NSMutableArray *someArrayBacking; | |
| } |
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
| // In MyClass.h | |
| @interface MyClass : NSObject | |
| @end | |
| // In MyClass.m | |
| @interface MyClass () | |
| - (void)a; | |
| - (void)b; |
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
| // In the header | |
| @interface MyClass : NSObject | |
| @property (readwrite, assign) int a; | |
| @end | |
| // In a separate header that you include in all MyClass subclasses | |
| @interface MyClass (Protected) |
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
| class Foo : public Bar | |
| { | |
| public: | |
| void printFoo(void); | |
| }; | |
| void Foo::printFoo(void) | |
| { | |
| cout << "Foo"; | |
| } |
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
| __block SomeObject *a = [SomeObject someObject]; | |
| [a setCompletion:^() | |
| { | |
| [self removeSomeObject:a]; | |
| }]; | |
| [self addSomeObject:a]; |
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
| [NSTask launchedTaskWithLaunchPath:@"/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool" | |
| arguments:[NSArray arrayWithObjects: | |
| @"-e", | |
| @"PVRTC", | |
| @"--channel-weighting-perceptual", | |
| compressionLevel, | |
| @"-f", | |
| @"PVR", | |
| @"-o", | |
| compressedTexturePath, |
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
| @implementation MyDocument | |
| - (void)dealWithCompressionFinished:(TextureAtlas *)ta | |
| { | |
| [textureController closeCompressingSheet]; | |
| if (nil == [ta previewImage]) | |
| { | |
| [[NSAlert alertWithMessageText:@"Invalid Texture" | |
| defaultButton:@"OK" |