¡@

Home 

2014/10/15 ¤U¤È 10:14:06

iphone Programming Glossary: shareddirector

Cocos2D 2.0 screenshots on iOS 6

http://stackoverflow.com/questions/12413460/cocos2d-2-0-screenshots-on-ios-6

and I just tested it on iOS 6 and it works fine. UIImage screenshotWithStartNode CCNode startNode CCDirector sharedDirector .nextDeltaTimeZero YES CGSize winSize CCDirector sharedDirector .winSize CCRenderTexture rtx CCRenderTexture renderTextureWithWidth.. screenshotWithStartNode CCNode startNode CCDirector sharedDirector .nextDeltaTimeZero YES CGSize winSize CCDirector sharedDirector .winSize CCRenderTexture rtx CCRenderTexture renderTextureWithWidth winSize.width height winSize.height rtx begin startNode.. rtx begin startNode visit rtx end return rtx getUIImage You can call it like this CCScene scene CCDirector sharedDirector runningScene CCNode n scene.children objectAtIndex 0 UIImage img AppController screenshotWithStartNode n share improve..

wrong position of tile map when i convert to retina display

http://stackoverflow.com/questions/12837104/wrong-position-of-tile-map-when-i-convert-to-retina-display

mode it gives 2.0. CCTMXObjectGroup objects tileMap objectGroupNamed NN_TILE_MAP_OBJECT_LAYER CGSize s CCDirector sharedDirector winSize NSMutableDictionary newtonPos objects objectNamed NN_NEWTON_POS if newtonPos float x newtonPos valueForKey @ x floatValue..

cocos2d: playing a video in the background of a menu

http://stackoverflow.com/questions/4454758/cocos2d-playing-a-video-in-the-background-of-a-menu

To handle the movie I instantiate a MPMoviePlayerController and then I add its view to the glView this way CCDirector sharedDirector openGLView addSubview moviePlayer.view I have seen this question was quite similar How to have a menu when a movie is playing.. count 1 UIImageView logo UIImageView alloc initWithImage UIImage imageNamed @ logo.png UIView theView CCDirector sharedDirector openGLView logo setCenter ccp 240 80 moviePlayer.view addSubview logo self unscheduleAllSelectors but the movie still remains.. 120 UIImageView logo UIImageView alloc initWithImage UIImage imageNamed @ stupidLogo.png UIView theView CCDirector sharedDirector openGLView logo setCenter ccp 240 80 logo.transform CGAffineTransformMakeRotation 3.14 2 moviePlayer.view addSubview logo..

cocos2d-iOS - Gesture recognisers

http://stackoverflow.com/questions/4985917/cocos2d-ios-gesture-recognisers

to something up the chain . Don't attach them to the individual nodes attach them to the UIView i.e. CCDirector sharedDirector openGLView . Here's what I did UIPanGestureRecognizer watchForPan SEL selector number int tapsRequired UIPanGestureRecognizer.. alloc initWithTarget self action selector autorelease recognizer.minimumNumberOfTouches tapsRequired CCDirector sharedDirector openGLView addGestureRecognizer recognizer return recognizer void unwatch UIGestureRecognizer gr CCDirector sharedDirector.. openGLView addGestureRecognizer recognizer return recognizer void unwatch UIGestureRecognizer gr CCDirector sharedDirector openGLView removeGestureRecognizer gr This particular code is used in a superclass for scene controllers so the target for..

Create layer mask with custom-shaped hole

http://stackoverflow.com/questions/5721196/create-layer-mask-with-custom-shaped-hole

code is ignoring the y axis differences between iPhone SDK and openGL. CAShapeLayer Example CGSize winSize CCDirector sharedDirector winSize UIImage img UIImage imageNamed @ zebra.png CCSprite spr CCSprite spriteWithCGImage img.CGImage key @ img spr.position.. layer colorLayer.bounds spr boundingBox colorLayer.position maskLayer.position colorLayer setMask maskLayer CCDirector sharedDirector openGLView layer addSublayer colorLayer Multiple Layer Mask Example CGSize winSize CCDirector sharedDirector winSize UIImage.. sharedDirector openGLView layer addSublayer colorLayer Multiple Layer Mask Example CGSize winSize CCDirector sharedDirector winSize UIImage img UIImage imageNamed @ zebra.png CCSprite spr CCSprite spriteWithCGImage img.CGImage key @ img spr.position..