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
KillableInterface : abstract class { | |
dyingNoise : abstract func -> String {} | |
} | |
KillableReference : cover { | |
obj : Pointer | |
impl : KillableInterfaceClass | |
} | |
KillableDog : abstract class extends KillableInterface { |
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
struct timeval start_time, end_time; | |
gettimeofday(&start_time, NULL); | |
for(int i=0; i<count; i++) | |
currDemo->updateFunc(i); | |
gettimeofday(&end_time, NULL); | |
long millisecs = (end_time.tv_sec - start_time.tv_sec)*1000; | |
millisecs += (end_time.tv_usec - start_time.tv_usec)/1000; |
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
#include <stdio.h> | |
void func2(int a, int b, int c, int d, int e){ | |
printf("%d %d %d %d %d\n", a, b, c, d, e); | |
} | |
void func1(int d){ | |
func2(1,2,3,4,d); | |
} |
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
#include <stdio.h> | |
void func2(int a, int b, int c){ | |
printf("%d %d %d\n", a, b, c); | |
} | |
void func1(int c){ | |
func2(1,2,c); | |
} |
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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdarg.h> | |
// NOTE: double precision floats count as two arguments | |
// givenArgc - count of arguments generated function should accept | |
// largeStruct - true if the function returns a struct larger than 4bytes | |
// func - function to wrap | |
// partialArgc - count of arguments passed by the trampoline to func |
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
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdarg.h> | |
// NOTE: double precision floats count as two arguments | |
// givenArgc - count of arguments generated function should accept | |
// largeStruct - true if the function returns a struct larger than 4bytes | |
// func - function to wrap | |
// partialArgc - count of arguments passed by the trampoline to func |
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
// iterating a singly linked list ring | |
// operations might include splicing or deleting elements | |
node *elt = first, *next; | |
do { | |
next = elt->next; | |
// do stuff here including modify elt->next | |
} while((elt = next) != first); | |
// is there a less verbose way? |
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
// ************** oggsteamer.h | |
#define NUM_BUFFERS 4 | |
#define BUFFER_SIZE 65536 | |
#define BUFFER_MSECS 10 | |
typedef struct { | |
char *data; | |
int data_length; | |
int seek_offset; |
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
@interface ChipmunkSprite : CCSprite { | |
ChipmunkBody *body; | |
cpBody *cp_body; | |
} | |
@property(retain) ChipmunkBody *body; | |
@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
#if COCOS2D_VERSION < 0x00009904 || 0x00009904 < COCOS2D_VERSION | |
#warning ChipmunkSprite has not been tested against this version of Cocos2D. | |
// ChipmunkSprite overrides a private method (getTransformValues) of CCSprite. | |
// This could break ChipmunkSprite if Cocos2D changes the method changes in a different version. | |
// ChipmunkSprite also overrides other CCNode and CCSprite methods to make sure the position and rotation is synchronized. | |
#endif | |
@implementation ChipmunkSprite | |
- (ChipmunkBody *)body {return body;} |
OlderNewer