Can anyone help me in converting this objective C code into c++?

#import “GameScene.h”
#import “GameOverScene.h”
#import “SimpleAudioEngine.h”;
#import “ResourceManager.h”
#import “OpenFeint.h”
#import “TouchableRegion.h”
#import “Button.h”
#import “SneakyJoystickSkinnedBase.h”
#import “ChristmasBounceAppDelegate.h”
#import “LevelUpScene.h”

`implementation GameScene
+(id) scene
{
// ‘scene’ is an autorelease object.
CCScene *scene = [CCScene node];

// 'layer' is an autorelease object.
GameScene *layer = [GameScene 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
{
// always call “super” init
// Apple recommends to re-assign “self” with the “super” return value
if( (self=[super init] )) {

    CGSize screenSize = [[CCDirector sharedDirector] winSize];
    CCSpriteFrameCache* frameCache = [ResourceManager sharedResourceManager].frameCache;
    CCAnimationCache* animCache=[CCAnimationCache sharedAnimationCache];

    CCSprite *bgSpr = [CCSprite spriteWithSpriteFrame:[frameCache spriteFrameByName:`“GameBG.png”]];

[bgSpr setPosition:ccp(screenSize.width*0.5f,screenSize.height*0.5f)];
[self addChild:bgSpr];

self.isTouchEnabled =YES;
//self.isAccelerometerEnabled=YES;

//[[UIAccelerometer sharedAccelerometer] setUpdateInterval:(1.0 / 60)];
infoRemoved=NO;
//paused=NO;
dropped= NO;
jumpStarted=NO;
joyAdded=NO;
vSpeed=hSpeed=0;
friction=0.95;
bounceControl=0.1;
resetTimer=1;
paddleSpeed=250;//increase this
toLevelUp=NO;
appDelegate = delegate];
int level=appDelegate.gameLevel;
//int padIndex;
int pappaIndex;
switch {
case 1:
padIndex=1;
pappaIndex=1;
padRadius=65;//smallest 42:pads5 >> 65,55,50,45,42
break;
case 2:
padIndex=1;
pappaIndex=2;
padRadius=65;
break;
case 3:
padIndex=2;
pappaIndex=1;
padRadius=55;
break;
case 4:
padIndex=2;
pappaIndex=3;
padRadius=55;
break;
case 5:
padIndex=3;
pappaIndex=2;
padRadius=50;
break;
case 6:
padIndex=3;
pappaIndex=3;
padRadius=50;
break;
case 7:
padIndex=4;
pappaIndex=3;
padRadius=45;
break;
case 8:
padIndex=4;
pappaIndex=1;
padRadius=45;
break;
case 9:
padIndex=5;
pappaIndex=2;
padRadius=42;
break;
case 10:
padIndex=5;
pappaIndex=1;
padRadius=42;
break;
default:
padIndex=1;
pappaIndex=1;
padRadius=65;
break;
}
CCSprite * paddle= ]];
;
;
float delay=0.1;
NSString pappaString=;
CCSprite
pappa = ];
CCAnimation* jump1= animationWithFrame:pappaString frameCount:14 delay:delay];
CCAnimation* jump2= animationWithFrameWithOffset:pappaString frameCount:14 delay:delay offset:14];
CCAnimation* jump3= animationWithFrameWithOffset:pappaString frameCount:14 delay:delay offset:28];
CCAnimation* jump4= animationWithFrameWithOffset:pappaString frameCount:12 delay:delay offset:42];
;
;
;
;
;
pappa.anchorPoint=ccp;
;
/*
readOut=;
readOut.position = ccp;
// Adjust the label’s anchorPoint’s y position to make it align with the top.
readOut.anchorPoint = ccp;
// Add the score label with z value of
1 so it’s drawn below everything else
[self addChild:readOut z:8];
/
CCLabelBMFont
scoreFirstLabel=[CCLabelBMFont labelWithString:"SCORE :" fntFile:“julius.fnt”];
scoreFirstLabel.position = ccp(75, screenSize.height);
// Adjust the label’s anchorPoint’s y position to make it align with the top.
scoreFirstLabel.anchorPoint = ccp(0.5f, 1.0f);
// Add the score label with z value of 1 so it’s drawn below everything else
;
scoreLabel=;
scoreLabel.position = ccp;
// Adjust the label’s anchorPoint’s y position to make it align with the top.
scoreLabel.anchorPoint = ccp;
// Add the score label with z value of
1 so it’s drawn below everything else
[self addChild:scoreLabel z:10];

CCLabelBMFont* pauseLabel=[CCLabelBMFont labelWithString:"PAUSE" fntFile:“julius.fnt”];
pauseLabel.position = ccp(screenSize.width-40, screenSize.height);
// Adjust the label’s anchorPoint’s y position to make it align with the top.
pauseLabel.anchorPoint = ccp(1.0f, 1.0f);
// Add the score label with z value of ~~1 so it’s drawn below everything else
;
TouchableRegion invButton = ;
//invButton.showOutline = YES; // Optionally draw an outline for testing
invButton.position = ccp;
;
if{
CCLabelTTF
infoLabel = dimensions:CGSizeMake alignment:CCTextAlignmentCenter fontName:"ButtonFont.TTF" fontSize:16]; infoLabel.position = ccp(screenSize.width*0.5, screenSize.height*0.5+80); [self addChild:infoLabel z:16 tag:7]; infoLabel.color= ccBLUE; [infoLabel setString:“Use joystick to move the paddle.sure the Xmas pappa lands on the paddle.him bouncing without going out of the area!”];
paused=YES;
CCLabelTTF* selectLabel = dimensions:CGSizeMake alignment:CCTextAlignmentCenter fontName:`“ButtonFont.TTF” fontSize:16];
selectLabel.position = ccp(screenSize.width0.5, screenSize.height0.5);
[self addChild:selectLabel z:5 tag:5];
selectLabel.color= ccBLACK;

        Button * left= [Button buttonWithText:`“Left” atPosition:ccp target:self selector:`selector(leftLogic:)];
        [self addChild:left z:3 tag:6];

        Button * right= [Button buttonWithText:`“Right” atPosition:ccp target:self selector:`selector(rightLogic:)];
        [self addChild:right z:4 tag:4];

    }else{
        paused=NO;
    }
    [self scheduleUpdate];
}
return self;

}
-(void)leftLogic:(ButtonItem *)index
{
CCLOG(`“left click”);
appDelegate.left=YES;
paused=NO;
}
~~(void)rightLogic:(ButtonItem )index
{
CCLOG (@“right click”);
appDelegate.left=NO;
paused=NO;
}
~~addJoystick
{
float stickRadius = 50;
SneakyJoystickSkinnedBase leftJoy = init] autorelease];
CGSize screenSize = winSize];
if{
leftJoy.position = ccp;
}else{
leftJoy.position = ccp;
}
joyAdded=YES;
// Sprite that will act as the outter circle. Make this the same width as joystick.
leftJoy.backgroundSprite = ;
// Sprite that will act as the actual Joystick. Definitely make this smaller than outer circle.
leftJoy.thumbSprite = ;
leftJoy.joystick = initWithRect:CGRectMake];
joystick = ;
;
}
pauseGame
{
if{
return;
}
CCLOG (@“pause”);
if{
paused=YES;
CGSize screenSize = winSize];
CCLabelBMFont* screenPause=;
screenPause.position = ccp;
// Adjust the label’s anchorPoint’s y position to make it align with the top.
screenPause.anchorPoint = ccp;
// Add the score label with z value of
1 so it’s drawn below everything else
;
Button
OfButton=;
;
setBackgroundMusicVolume:0.0];
CCLabelBMFont* pauseLabel=;
;
//[self unscheduleUpdate];
pause];
appDelegate.manuallyPaused=YES;
}else{
paused=NO;
;
;
CCLabelBMFont* pauseLabel=;
;
setBackgroundMusicVolume:1.0];
resume];
appDelegate.manuallyPaused=NO;
}
}
~~openFeintDash:index
{
CCLOG (@“of click, %@”,index);
BlankOFDelegate
ofDelegate = [BlankOFDelegate new];
[OpenFeint launchDashboardWithDelegate:ofDelegate];
}
startJump:pappa
{
;
CCSprite * paddle= ;
//float offset=;
float xDif = paddle.position.x
pappa.position.x;
float yDif = pappa.position.y - paddle.position.y;
float offset = sqrt(xDif * xDif + yDif * yDif);

CCAnimationCache* animCache=[CCAnimationCache sharedAnimationCache];
if (offset>padRadius)
{
if(appDelegate.gameScore>appDelegate.gameLevel*15+appDelegate.gameLevel&&appDelegate.gameLevel10){
//levelup
toLevelUp=YES;
}else{
CCLOG(@“fall”);
dropped=YES;
}
}else{
float offsetAngle=ccpToAngle(ccpSub(pappa.position, paddle.position))+CC_DEGREES_TO_RADIANS(180);
if(CCRANDOM_0_1()<0.5){
offsetAngle+=CC_DEGREES_TO_RADIANS(CCRANDOM_0_1()*15);
}else{
offsetAngle-=CC_DEGREES_TO_RADIANS(CCRANDOM_0_1()*15);
}

    offset+=CCRANDOM\_0\_1()\*5;
    offset\*=1.5;
    vSpeed=offset\*sin(offsetAngle)\*bounceControl;
    hSpeed=offset\*cos(offsetAngle)\*bounceControl;
    //CCLOG(@"bounce");

    [paddle setDisplayFrame:[[ResourceManager sharedResourceManager].frameCache spriteFrameByName:[NSString stringWithFormat:@"pads%i2.png",padIndex]]];
     resetTimer=0;
    id action;
    int switcher=(int)CCRANDOM\_0\_1()\*4;
    if(switcher3){

action = [CCAnimate actionWithAnimation:[animCache animationByName:"jump2"]]; }else if(switcher==1){ action = [CCAnimate actionWithAnimation:[animCache animationByName:“jump3”]];
}else if(switcher2){
action = [CCAnimate actionWithAnimation:[animCache animationByName:@“jump4”]];
}else{
action = [CCAnimate actionWithAnimation:[animCache animationByName:@“jump1”]];
}

    id cleanupAction = [CCCallFuncND actionWithTarget:self selector:@selector(startJump:) data:pappa];
    id seq = [CCSequence actions:action, cleanupAction, nil];
    [pappa runAction:seq];
    jumpStarted=YES;

    appDelegate.gameScore++;

    NSString\* tempLabel=[NSString stringWithFormat:@"%i", appDelegate.gameScore];
    [scoreLabel setString:tempLabel];
    if(appDelegate.gameScore\>appDelegate.gameLevel\*15+appDelegate.gameLevel&&appDelegate.gameLevel!=10){
        //levelup
        toLevelUp=YES;
    }else{

        [[SimpleAudioEngine sharedEngine] playEffect:@"jump.caf"];
    }

    if(appDelegate.gameLevel1 && appDelegate.gameScore==4 && !infoRemoved){

infoRemoved=YES;
[self removeChildByTag:7 cleanup:YES];
}

}

}
~~update:delta
{
if{
return;
}
if{
CCLOG (@“falling”);
playEffect:`“fall.caf”];
[self unscheduleUpdate];
[self gameOver];
return;
}
if(toLevelUp){
[self unscheduleUpdate];
[self levelUp];
return;
}
if(!joyAdded){
[self removeChildByTag:5 cleanup:YES];
[self removeChildByTag:4 cleanup:YES];
[self removeChildByTag:6 cleanup:YES];

    [self addJoystick];
    return;
}
CGSize screenSize = [[CCDirector sharedDirector] winSize];
CCSprite * paddle= (CCSprite*) [self getChildByTag:2];

CGPoint velocity = ccpMult(joystick.velocity, paddleSpeed);

if (velocity.x != 0 && velocity.y != 0)
{
    CGPoint tempPt=CGPointMake(paddle.position.x + velocity.x * delta, paddle.position.y + velocity.y * delta);
    if(tempPt.x<0){
        tempPt.x=0;
    }
    if(tempPt.x>screenSize.width){
        tempPt.x=screenSize.width;
    }
    if(tempPt.y<0){
        tempPt.y=0;
    }
    if(tempPt.y>screenSize.height){
        tempPt.y=screenSize.height;
    }
    paddle.position = tempPt;
}
if(resetTimer>=0){
    resetTimer++;
    if(resetTimer>=12){
        resetTimer=-1;
        CCLOG(`“reset”);

.frameCache spriteFrameByName:]];
}
}
CCSprite* pappa = ;
vSpeed**=friction;
hSpeed**=friction;
CGPoint position=pappa.position;
position.x*=hSpeed;
position.y*=vSpeed;
if{
position.x=1;
hSpeed*=~~1;
appDelegate.gameScore++;
}
if(position.x>screenSize.width){
position.x=screenSize.width-1;
hSpeed*=~~1;
appDelegate.gameScore**;
}
if{
position.y=1;
vSpeed*=~~1;
appDelegate.gameScore++;
}
if{
position.y=screenSize.height-1;
vSpeed*=~~1;
appDelegate.gameScore**;
}
pappa.position=position;
if{
;
}

}
~~ (void) gameOver
{
if(paused){
paused=NO;
[self removeChildByTag:13 cleanup:YES];
[self removeChildByTag:14 cleanup:YES];
}
int score=appDelegate.gameScore;
int x = [[NSUserDefaults standardUserDefaults] integerForKey:"ChristmasBounceScore"]; if(score>x){ [[NSUserDefaults standardUserDefaults] setInteger:score forKey:“ChristmasBounceScore”];
}
[self removeAllChildrenWithCleanup:YES];

CCLOG (@“game over”);
[[CCDirector sharedDirector] replaceScene:[GameOverScene scene]];

}

  • (void) levelUp
    {
    if(paused){
    paused=NO;
    [self removeChildByTag:13 cleanup:YES];
    [self removeChildByTag:14 cleanup:YES];
    }
    int score=appDelegate.gameScore;
    int x = [[NSUserDefaults standardUserDefaults] integerForKey:"ChristmasBounceScore"]; if(score>x){ [[NSUserDefaults standardUserDefaults] setInteger:score forKey:“ChristmasBounceScore”];
    }
    [self removeAllChildrenWithCleanup:YES];

CCLOG (@“level up”);
[[CCDirector sharedDirector] replaceScene:[LevelUpScene scene]];

}
// on “dealloc” you need to release all your retained objects

  • (void) dealloc
    {
    // in case you have something to dealloc, do it in this method
    // in this particular example nothing needs to be released.
    // cocos2d will automatically release all the children (Label)

// don’t forget to call “super dealloc”
[super dealloc];
}

@end