Skip to content

Instantly share code, notes, and snippets.

@skyfe79
skyfe79 / gist:1593500
Created January 11, 2012 07:10 — forked from eric-robinson/gist:1593197
Hex string to NSColor
@interface NSString(ColorAdditions)
-(NSColor*)hexStringToNSColor;
@end
@implementation NSString(ColorAdditions)
-(NSColor *) hexStringToNSColor {
unsigned int c;
if ([self characterAtIndex:0] == '#') {
@skyfe79
skyfe79 / Lightning.h
Created January 11, 2012 09:07 — forked from jeksys/Lightning.h
Lighting, cocos2D
//
// Lightning.h
// Trundle
//
// Created by Robert Blackwood on 12/1/09.
// Copyright 2009 Mobile Bros. All rights reserved.
//
#import "cocos2d.h"
@skyfe79
skyfe79 / VideoSpriteBatchNode.h
Created January 11, 2012 09:08 — forked from egradman/VideoSpriteBatchNode.h
cocos2d video sprite (batch node)
@interface VideoSpriteBatchNode: CCSpriteBatchNode
{
AVURLAsset *asset;
AVAssetTrack *videoTrack;
AVAssetReader *assetReader;
AVAssetReaderTrackOutput *trackOutput;
}
@property(nonatomic,retain) AVURLAsset *asset;
@property(nonatomic,retain) AVAssetTrack *videoTrack;
@property(nonatomic,retain) AVAssetReader *assetReader;
@skyfe79
skyfe79 / gist:1593831
Created January 11, 2012 09:09 — forked from hlxwell/cocos2d.m
animation from cocos2d to UIView
-(void)openHighScoreView {
GameOverView *tempView = [[HighScoreView alloc] init];
selfish = tempView;
[tempView release];
[[CCDirector sharedDirector]replaceScene:[MainScene node]];
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.5];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:[[CCDirector sharedDirector] openGLView] cache:YES];
[[[CCDirector sharedDirector] openGLView] addSubview:go.view];
@skyfe79
skyfe79 / MCCard.m
Created January 11, 2012 09:10 — forked from bontoJR/MCCard.m
Realistic card turn with Cocos2d
- (void)turnCard
{
if ([self isFaceUp]) {
[self flipHide];
self.faceUp = NO;
} else {
self.faceUp = YES;
[self flipReveal];
}
}
@skyfe79
skyfe79 / sample.lua
Created January 11, 2012 09:10 — forked from marcoleong/sample.lua
Lua cocos2d-x sample
require "hello2"
cocos2d.CCLuaLog("result is " .. myadd(3, 5))
-- create scene & layer
layerFarm = cocos2d.CCLayer:node()
layerFarm:setIsTouchEnabled(true)
layerMenu = cocos2d.CCLayer:node()
@skyfe79
skyfe79 / Scale9SPrite.m
Created January 11, 2012 09:11 — forked from nsxdavid/Scale9SPrite.m
Scale9Sprite - A Cocos2d 9-Slice Sprite
//
// Scale9Sprite.m
//
// Creates a 9-slice sprite.
#import "Scale9Sprite.h"
@skyfe79
skyfe79 / SpritePositioning.h
Created January 11, 2012 09:13 — forked from AsadR/SpritePositioning.h
Cocos2D helper class to position sprites "by hand"
//
// SpritePositioning.h
//
//
// Created by Asad ur Rehman
//
#import "cocos2d.h"
@interface SpritePositioning : CCSprite <CCTargetedTouchDelegate, NSCoding> {
@skyfe79
skyfe79 / gist:1593845
Created January 11, 2012 09:13 — forked from l4u/gist:1256288
cocos2d-x prevent touch propagation to other layers
// UpdateLayer.cpp
// prevent touch propagation to other layers
// cocos2d-1.0.1-x-0.9.1
void UpdateLayer::onEnter()
{
CCLayer::onEnter();
CCTouchDispatcher::sharedDispatcher()->addTargetedDelegate(this, 0, true);
...
}
@skyfe79
skyfe79 / FollowAction.h
Created January 11, 2012 09:15 — forked from hugowetterberg/FollowAction.h
Cocos2D action that makes a node move towards a specific point at a set speed
//
// FollowAction.h
// Battle Pong
//
// Created by Hugo Wetterberg on 2009-11-29.
// Copyright 2009 Good Old. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "cocos2d.h"