Skip to content

Instantly share code, notes, and snippets.

@skyfe79
skyfe79 / gist:1593859
Created January 11, 2012 09:16 — forked from seanh/gist:1219425
Computing the "full bounding box" of a CCNode in Cocos2D. (Put this code in a CCNode subclass.)
/*!
Return the -boundingBox of another node, converted into this node's local
coordinate space.
*/
-(CGRect) boundingBoxConvertedToNodeSpace:(CCNode *)other
{
// Get the bottomLeft and topRight corners of the other node's bounding box
// in the other node's coordinate space.
CGRect boundingBox = [other boundingBox];
CGPoint bottomLeft = CGPointMake(boundingBox.origin.x, boundingBox.origin.y);
@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 / 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.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 / 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 / UIPanPinchRotationGesture.m
Created June 1, 2012 09:52
Using Pan, Pinch and Rotation gestures
-(void)addGesture
{
//: 드래그
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGesture:)];
pan.minimumNumberOfTouches = 1;
pan.maximumNumberOfTouches = 1;
[someView addGestureRecognizer:pan];
//: 핀치
UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinchGesture:)];
@skyfe79
skyfe79 / Lightning.h
Created June 1, 2012 10:05 — 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 / TGScoreLabel.h
Created June 1, 2012 10:08 — forked from talentless/TGScoreLabel.h
A Score Label for Cocos2d
#import <Foundation/Foundation.h>
#import "cocos2d.h"
@interface TGScoreLabel : CCLabelTTF {
double curScore_; // the current score value of the label
BOOL updating_; // if we currently have an update running
double interval_; // how long we wait between updates
int score; // the target score
NSString * formatString; // the string that we format
#include <OpenGL/OpenGL.h>
#include <GLUT/GLUT.h>
int main(int argc, const char * argv[])
{
glutInit(&argc, const_cast<char **>(argv));
return 0;
}
@skyfe79
skyfe79 / GLUT01_2.cpp
Created June 24, 2012 03:46
GLUT01-2
#include <OpenGL/OpenGL.h>
#include <GLUT/GLUT.h>
void renderScene(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}