Skip to content

Instantly share code, notes, and snippets.

@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 / retinafy_tmx.py
Created January 11, 2012 09:16 — forked from chrx/retinafy_tmx.py
Adjust a TMX map file created in Tiled for use with the retina display in Cocos2d
#!/usr/bin/env python
u"""
Upscales a Tiled TMX map for use with a retina display.
Fixes tile size, object position and size, image size.
Saves the retina file as filename-hd.tmx in the same folder as the source file.
"""
@skyfe79
skyfe79 / CCSpriteFrameCache_SWF.mm
Created January 11, 2012 09:19 — forked from talentless/CCSpriteFrameCache_SWF.mm
CCSpriteFrameCache_SWF.mm
//
// CCSpriteFrameCache_SWF.h
// CCSpriteFrameCache_SWF_Extension
//
// Created by Salvatore Gionfriddo on 11/28/11.
// Copyright (c) 2011 Taco Graveyard. All rights reserved.
//
#include <vg/openvg.h>
#include <vg/vgu.h>
@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 / 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 / GFFParallaxNode.h
Created January 11, 2012 09:18 — forked from rolandoam/GFFParallaxNode.h
GFFParallaxNode
//
// GFFParallaxNode.h
//
// Created by Rolando Abarca on 12/14/09.
//
#import <Foundation/Foundation.h>
#import "cocos2d.h"
#define MAX_PARALLAX_CHILDREN 25
@skyfe79
skyfe79 / CCSpriteFrameCache_SWF.h
Created January 11, 2012 09:19 — forked from talentless/CCSpriteFrameCache_SWF.h
CCSpriteFrameCache_SWF.h
#import <Foundation/Foundation.h>
#import "cocos2d.h"
@interface CCSpriteFrameCache (SWF)
-(void) addSpriteFramesWithSWF:(NSString*)filename;
@end
@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 / 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];
}
}