A court in China has ordered Apple to pay compensation to eight Chinese writers and two companies for violating their copyrights.
They had claimed that unlicensed electronic versions of their books had been sold on Apple’s online store.
The court ordered Apple to pay them 1.03m yuan ($165,000; £100,000) in compensation, according to the official news agency Xinhua.
… Read more from here.
http://www.bbc.co.uk/news/business-20856199
This is so simple
1. Go to your Google + account (https://plus.google.com/).
2. Click on the Profile icon on the Left.
3. If you look at the URL in the address bar, it should look something like this:
https://plus.google.com/104653270154306099169/posts
4. The long numerical string in the URL is your Google+ ID. Here is CoderzHeaven’s from the URL above:
104653270154306099169/

This is a sample code to move a body in Box2D .
First you have to make a body with variable name “moving_rec” and call the below function in a schedular at regular intervals.
-(void) moveBody{
b2Vec2 force = b2Vec2(0,0);
force = b2Vec2(0,3); //Giving the x an y to negative will move the body in opposite direction.
moving_rec->SetLinearVelocity(force); //set Linear velocity for moving in a constant speed.
}
Please leave your comments on this post.
Hi,
For pausing a cocos2D game, then use the following line of code.
[[CCDirector sharedDirector] pause];
For resuming a cocos2D game, then use this line of code.
[[CCDirector sharedDirector] resume];
More than usually we need to apply the functions of Pause and Resume/Play for our games. In Mac’s cocos2D programming it’s more than simple. Simply use the following code for Pause & Resume where ever you want!
/*For Pausing the game*/
[[CCDirector sharedDirector] pause];
[self pauseSchedulerAndActions]; //Call for pausing all schedulers and actions
/*For Resuming/Playing back the game*/
[[CCDirector sharedDirector] resume];
[self resumeSchedulerAndActions]; // Call for resuming all schedulers and actions
Hi,
Sometimes you may need to make some of your b2Body non rotating or static while using Box2D physics engine.
For making any body static use the following line of code.
UrbodyDef.fixedRotation = true;
Hi,
Collision can be detected simply using the following lines of code with box2D.
if((contact.fixtureA == aimFixture && contact.fixtureB == tarFixture) ||
(contact.fixtureA == tarFixture&& contact.fixtureB == aimFixture ))
{
NSLog(@"Collision between aim fixture and target fixture detected!");
}
Here aimFixture & tarFixture are two custom fixtures whose collision you want to find out.
CCWaves is one of the interesting functionalities in Cocos2D iphone.
Check out this following snippet to see how it works.
id my_wavesAction = [CCWaves actionWithWaves:7 amplitude:25 horizontal:NO
vertical:YES grid:ccg(15,10) duration:10];
[my_sprite runAction: [CCRepeatForever actionWithAction:my_wavesAction n]];
Please leave your valuable comments on this post………………….
Hi,
If you want to scroll a UIScrollView programatically as the result of any IBOutlet actions, use the following code in that particular action.
[yourScroller setContentOffset:CGPointMake(0,250) animated:YES];
This will scroll your scroller named ‘yourScroller’ automatically to the point specified!
Hello all……
We may need to know that what is your current device orientation.
Using the below code you can do this.
if([[UIDevice currentDevice] orientation] == kCCDeviceOrientationPortrait) {
NSLog(@"Device is now in Portrait Mode");
}
else if ([[UIDevice currentDevice] orientation] == kCCDeviceOrientationLandscapeLeft) {
NSLog(@"Device is now in LandscapeLeft Mode ");
}
else if ([[UIDevice currentDevice] orientation] == kCCDeviceOrientationLandscapeRight) {
NSLog(@"Device is now in LandscapeRight Mode");
}
else if([[UIDevice currentDevice]orientation] ==
kCCDeviceOrientationPortraitUpsideDown) {
NSLog(@"Device is now in PortraitUpsideDown Mode");
ss="Apple-style-span" style="font-weight: normal;">
}
Note: If you have to explicitly set the orientation of your phone to any of the above you can set this in the appDelegate.m file. You can put an “||” (OR) symbol in between to set more than one.
Please leave your valuable comments if this post was useful…..
Hello………
Sometimes you may want your body to act against the gravity of the world.
One method to do this is described below.
First what you have to do is to make a body in the shape of a circle and give it the image of a balloon as the userdata.
Then in the tick function write this code.
This method of applying the force is called “The antagonist forces method”
By this method we are giving an upward force to only our balloon body irrespective of the gravitational force.
After running the code you will see your body floating in air like a balloon.
for (b2Body* b = world->GetBodyList(); b; b = b->GetNext())
{
if (b->GetUserData() != NULL) {
if (b==baloonBody) {
b->ApplyForce( b2Vec2(0.0,9.8*b->GetMass()),b->GetWorldCenter()); // here 0.0 is x, 9.8 is y (the gravity)
}
}
}
Note: Try to change the value 9.8 to higher if you have given your world’s gravity as 9.8. It will produce a balloon effect.
Please leave your comments if this post was useful……….
Hi,
Setting a background image to the UITableView will make it looks great! Use the following code to set a background image to a UITableView.
UIImage *bgImage= [UIImage imageNamed:@"sampleImage.png"];
UIImageView *bgView= [[UIImageView alloc] initWithImage:bgImage];
urTblView.backgroundView = bgView;
Here ‘urTblView’ is your UITableView.
You can simulate any animations if you have a sequence of images which makes the illusion of that
animations and rendering those images to the screen. In cocos2D it can be done in two ways, with sprite sheet
animation and without sprite sheets. Here we are going to see how it can be done with out sprite sheet.
CCAnimation *sitDown = [CCAnimation animationWithName:@"sitDown" delay:0.1f];
[sitDown addFrameWithFilename:@"sit1.png"];
[sitDown addFrameWithFilename:@"sit2.png"];
[mySprite addAnimation:sitDown];
id sitAction = [CCAnimate actionWithAnimation:sitDown restoreOriginalFrame:YES];
[yourSprite runAction:sitAction];
Here CCAnimation holds a series of images known as Frames and CCAnimate is simply the action which will run the
CCAnimation. Simple.
Suppose that we have two images named, sit1.png and sit2.png which simulates a sitting animation of our sprite. First
we have added that images/frames to our CCAnimation object sitDown. Then we CCAnimate our CCAnimation frames and
deploy those actions to our sprite. We can set the delay time between the individual frames in CCAnimation. Also we can restore the original image before sprite animation after animatin completes or not!That’s it.
We will later see in here how Sprite Animations can be done by using Sprite Sheets. Keep in touch.
Hi,
For removing the forces applied to your Box2D bodies, use the following line of code.
yourWorld->ClearForces();
Here ‘yourWorld’ is the your box2D world.
Hi,
For calling a function after a definite time interval in Cocos2D, use the following code.
[self performSelector:@selector(yourFunction) withObject:nil afterDelay:7.0];
this will call the function ‘yourFunction’ after 7 seconds.
Hi,
For adding a custom font in a UITextView, use the following code.
IBOutlet UITextView *myTextField;
[myTextField setFont:[UIFont fontWithName:@"Helvetica" size:20]];
Hi,
For showing particle effects repeatedly in Cocos2D, use the sample code.
CCParticleSystemQuad *yourParticleEffect = [CCParticleSystemQuad particleWithFile:@"yourEffect.plist"];
[self addChild:yourParticleEffect z:5];
This will show the effect ‘yourEffect’ repeatedly in your game.
Hi,
In order to get the UUID of an iPhone, iPod or iPad, do the following in your code.
NSString *myUUIDStr= [UIDevice currentDevice].uniqueIdentifier;
Here ‘myUUIDStr’ will contain the UUID of your specified iOS device.
Hi,
In order to make a UITextField a Password Field / Password Mode do the following.
In your .h class file,
IBOutlet UITextField *urPassword;
In your .m class file,
urPassword.secureTextEntry = YES;
This will make your UITextField in a Password entry mode or a Password Field.
Hi,
In order to set the font type of UITextView, do the following.
In your .h class file,
IBOutlet UITextView *urTextView;
In your .m class file,
[urTextViewsetFont:[UIFont fontWithName:@"Arial Rounded MT Bold" size:18]];
This will set ‘urTextView’ with font name ‘Arial Rounded MT Bold’ with font size 18.
Hi,
In order to make a UITextField with out or no border, do like this.
In your .h class file,
IBOutlet UITextField *urTextField;
In your .m class file,
urTextField.borderStyle = UITextBorderStyleNone;
Thus you will get a UITextField named urTextField without border.
Hi,
For making non colliding bodies in Box2D, you may need to give SAME, NEGATIVE, group index to the b2FixtureDef of bodies you created. See the following code.
fixtureDefA.filter.groupIndex = -7;
fixtureDefB.filter.groupIndex = -7;
The bodies with the above two fixture definitions won’t collide.
Hi,
For Pausing all schedulers and actions in Cocos2D, use this line.
[self pauseSchedulerAndActions];
For resuming the paused schedulers and actions, use this.
[self resumeSchedulerAndActions];
Hi,
For opening a Web Link/URL from an iPhone application, follow the two simple steps.
Step 1 :
Create an NSURL object and initialize it with your URL string
NSURL *myURL = [NSURL URLWithString:@"http://www.coderzheaven.com/"];
;
Step 2 :
Use the openURL method by passing your NSURL object
[[UIApplication sharedApplication] openURL: myURL];
Done.
Hi,
Some times while game building via Box2D Physics Engine, you may need to find out whether your bodies (from b2Body) are moving or not. Use the following sample of code to find out whether the given b2Body is moving or not.
b2Body *urBody;
if(urBody->IsAwake()
{
//urBbody is moving! It's not in rest!
}
else
{
//urBody is at rest!
}