[Cocos2d] ‘sharedDispatcher’ is deprecatedと言われたときの対処方
cocos2d v2.0で、以下のように書いたらdeprecatedと言われちゃいました。 [CCTouchDispatcher sharedDispatcher] ‘sharedDispatcher’ is deprecated ccDeprecated.mを覗くと以下のようになっていますね。 @implementation CCTouchDispatcher (Deprecated)...
View Article[Cocos2d] Sending ‘ClassName *’ to parameter of incompatible type...
cocos2d v2.0で、以下のように書いたらincompatible typeと言われちゃいました。 [[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES]; Sending ‘ClassName *’ to parameter of...
View Article[Cocos2d] CCSpriteクラスのサブクラスを作る
cocos2dで、CCSpriteクラスのサブクラスを作る方法です。 例として、CCSpriteを継承したDogクラスを作成してみます。 Dog.h12345#import <Foundation/Foundation.h> #import "cocos2d.h" @interface Dog : CCSprite +(id)dog; @end...
View Article[Cocos2d] タッチイベントを検知する
cocos2dで、タッチイベントを検知する方法です。 1.isTouchEnabledをYESに設定 SampleLayer.m12345678- (id)init { self = [super init]; if (self) { self.isTouchEnabled = YES; } return self; }...
View Article[Cocos2d] 現在のSceneを取得する
cocos2dで、現在のSceneインスタンスを取得する方法です。 CCDirectorのrunningSceneメソッドで取得できました。1SampleScene *sampleScene = (SampleScene*)[[CCDirector sharedDirector] runningScene]; 環境 OS X 10.8 Xcode 4.4 cocos2d v2.0
View Article[Cocos2d] シーンの背景色を設定する
cocos2dで、シーンの背景色を設定する方法です。 例では、CCLayerColorオブジェクトを作って、SceneにaddChildしています。 SampleScene.m123456789101112#import "SampleScene.h" @implementation SampleScene - (id)init { self = [super init]; if...
View Article
More Pages to Explore .....