¡@

Home 

2014/10/15 ¤U¤È 10:04:57

iphone Programming Glossary: ccdirector

Cocos2D 2.0 screenshots on iOS 6

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

take a screenshot 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.. fine. UIImage screenshotWithStartNode CCNode startNode CCDirector sharedDirector .nextDeltaTimeZero YES CGSize winSize CCDirector sharedDirector .winSize CCRenderTexture rtx CCRenderTexture renderTextureWithWidth winSize.width height winSize.height.. height winSize.height 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..

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

In retina 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..

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

depicted. 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.. if windows 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.. timer if timer 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..

cocos2d-iOS - Gesture recognisers

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

recognizer 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..

Create layer mask with custom-shaped hole

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

The sample 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.. CALayer 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.. maskLayer CCDirector 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..