Category : IOS/Iphone Apps

NSOperation vs GCD

In addition to run loops, threads and operations, Snow Leopard adds Grand Central Dispatch (GCD), a very lightweight way to represent units of work and the style of concurrency they need, and have the system figure out how to schedule them. It shouldn’t surprise you in the least to learn that NSOperation, on Snow Leopard,

Read More →

753 total views, no views today

post image

sqlite integration in cocos2d-x

SQLite is basically used for creating and maintaining databases in the games which have some complex data to save.So, in this tutorial we will learn to integrate sqlite in our cocos2d-x game in xcode using c++ Step 1 First create a default HelloWorld project and in your HelloWorldScene.cpp , delete the lines in init function

Read More →

4,682 total views, no views today

How to get current date,time,month and year in cocos2dx

In order to get the current date,time,we can use 2 methods-either using the localtime of the desktop or using GMT(GREENWICH MEAN TIME) //USING THE LOCAL TIME time_t time; struct tm * timeinfo; time (&time); timeinfo = localtime (&time); CCLog(“year->%d”,timeinfo->tm_year+1900); CCLog(“month->%d”,timeinfo->tm_mon+1); CCLog(“date->%d”,timeinfo->tm_mday); CCLog(“hour->%d”,timeinfo->tm_hour); CCLog(“minutes->%d”,timeinfo->tm_min); CCLog(“seconds->%d”,timeinfo->tm_sec); //USIMG GMT Replace the above line timeinfo = localtime (&time);withtimeinfo =gmtime

Read More →

4,043 total views, no views today

How to enable multitouch in cocos2dx

In order to enable multitouch just go to your Then in the function didFinishLaunchingWithOptions after creating the EAGL View add the following line. [__glView setMultipleTouchEnabled:YES]; Then the didfinishlaunchingwithoptions will look like: (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. // Add the view controller’s view to the window and

Read More →

4,095 total views, no views today

How to load b2bodies from physics editor and remove the corresponding body with its sprite of an array on touch in cocos2dx

//ADD SPRITES TO THE SCENE CCSprite *sprite1=CCSprite::create(“sprite1.png”); //Let the scaling factor is rX and rY for X and Y direction sprite1->setScaleX(rX); sprite1->setScaleY(rY); scene->addChild(sprite1); //Similarly we can add other sprites also which are to be in the array //ADD ALL THESE SPRITES TO THE CCARRAY CCArray *arr=new CCArray; arr->addObject(sprite1); In above sprite declaration,position of the sprite

Read More →

1,335 total views, 1 views today

1 2 3