Welcome

--------

Tuesday, 22 February 2011

Cocos2d - Hyperlink a label


Here’s a quick tutorial and some code to hyperlink a label (or some text) in cocos2d. Hopefully could be helpful for others iPhone App developers.

Firstly declare your bounding box for the label:

CGRect bbox;

Then have your code written for the label as such, and find the bounding box of the label:

CCLabel* linkLabel = [CCLabel labelWithString:@" visit us at http://www.mysite.com" fontName:@"Arial" fontSize:20]; //insert your label text here 

linkLabel.position = CGPointMake(screenSize.width / 2, screenSize.height / 4.5); // position the label

[self addChild:linkLabel z:100 tag:101]; //add the label to the scene (view)

bbox = [linkLabel boundingBox]; // returns the bounding box of the label

Finally, in your touch recognition method, you add the following code
-(void) ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch* touch = [touches anyObject];
CGPoint touchLocation = [self convertTouchToNodeSpace:touch];//get the touch point

NSString* url = @"http://www.mysite.com"; //url for the link.


//check to see if the touch location was inside the bouncing box, and open url. 


if (CGRectContainsPoint(bbox, touchLocation)) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
}
}

Any problems give me a shout, or if there is an easier way let us know.  

 


Tuesday, 26 October 2010

Number Cruncher

 Finally managed to release a new game its called Number Crucncher, screenshots. Check it out...


Sunday, 13 June 2010

PressUp+ app launhed


My iphone app has finally Launched, it's called PressUp+...check it out here....

http://itunes.apple.com/gb/app/pressup/id376561199?mt=8

it counts the pressups or number of push ups you do outloud and gives you a score based on how many you can do in a minute. Plus the amount of energy you use, calories burned, and power output. Enjoy.

will try to add screenshots soon.

Sunday, 6 June 2010

App Readying for Launch

Looking to submit to App Store soon