Skip to content

Instantly share code, notes, and snippets.

View sdabet's full-sized avatar

Sébastien Dabet sdabet

  • Grenoble, France
View GitHub Profile
CCNode *node = [CCNode node];
[node addChild:child1];
[node addChild:child2];
// ...
[node centerContentWithPadding:10 TotalWidth:[[CCDirector sharedDirector] winSize].width];
- (NSUInteger)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
{
return UIInterfaceOrientationMaskAllButUpsideDown;
}
#import <UIKit/UIKit.h>
@interface LandscapeNavigationController : UINavigationController
@end
#import "LandscapeNavigationController.h"
@implementation LandscapeNavigationController
-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
navController_ = [[UINavigationController alloc] initWithRootViewController:director_];
navController_ = [[LandscapeNavigationController alloc] initWithRootViewController:director_];
@interface CustomScrollLayer : CCScrollLayer
@property (nonatomic, retain) CCNode *customPageIndicators;
+(id) nodeWithLayers:(NSArray *)layers widthOffset:(int)widthOffset pageSpriteFrameName:(NSString*)pageSpriteFrameName;
-(id) initWithLayers:(NSArray *)layers widthOffset:(int)widthOffset pageSpriteFrameName:(NSString*)pageSpriteFrameName;
@end
@implementation CustomScrollLayer
@synthesize customPageIndicators;
+(id) nodeWithLayers:(NSArray *)layers widthOffset: (int) widthOffset pageSpriteFrameName:(NSString*)pageSpriteFrameName
{
return [[[self alloc] initWithLayers: layers widthOffset:widthOffset pageSpriteFrameName:pageSpriteFrameName] autorelease];
}
/*
@implementation NodeRenderer
+(id)renderTextureWithNode:(CCNode*)node width:(int)w height:(int)h
{
return [[[self alloc] initWithNode:node width:w height:h pixelFormat:kCCTexture2DPixelFormat_RGBA8888 depthStencilFormat:0] autorelease];
}
-(id) initWithNode:(CCNode*)n width:(int)w height:(int)h pixelFormat:(CCTexture2DPixelFormat)format depthStencilFormat:(GLuint)depthStencilFormat {
if(self = [super initWithWidth:w height:h pixelFormat:format]) {
[self addChild:n];
@interface NodeRenderer : CCRenderTexture
+(id)renderTextureWithNode:(CCNode*)node width:(int)w height:(int)h;
-(id) initWithNode:(CCNode*)n width:(int)w height:(int)h pixelFormat:(CCTexture2DPixelFormat)format depthStencilFormat:(GLuint)depthStencilFormat;
@end