Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- +(id) scene
- {
- // 'scene' is an autorelease object.
- CCScene * scene = [CCScene node];
- // 'layer' is an autorelease object.
- HelloWorld * layer = [HelloWorld node];
- // add layer as a child to scene
- [scene addChild: layer];
- // return the scene
- return scene;
- }
- // - - -
- // on "init" you need to initialize your instance
- -(id) init
- {
- if( (self=[super init] ))
- {
- CCLayerColor* colorLayer = [CCLayerColor layerWithColor: ccc4(0, 167, 167, 67)];
- colorLayer.anchorPoint = ccp (.5, .5); // << makes no diff
- colorLayer.position = ccp(.0, .0);
- [self addChild:colorLayer z: -1];
- Wheel * wheel = [ [ [Wheel alloc] init] autorelease];
- [wheel setupWithMagnets: 3];
- // takes orientation into account
- CGSize winSize = [[CCDirector sharedDirector] winSizeInPixels];
- printf("%f, %f\n", (float) winSize.width, (float) winSize.height);
- wheel.position = ccp ( winSize.width / 2 - 1, winSize.height / 2 - 1 );
- printf("%f, %f\n", (float) wheel.position.x, (float) wheel.position.y);
- [self addChild: wheel];
- // - - -
- }
- return self;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement