Thursday, May 31, 2012

cocos2d-x resume from background issue...


I love cocos2d-x, it helps me to write games quickly on iOS and android with just one code base.

But I found a small problem that if my cocos2d-x games run into background, and when it get back to foreground, it will restart !

That means if you play my game for a while and a phone call just received, after you pick up the call, you will need to re-play the game from the very first stage.

That's bad, and I don't like it !

After a while googling, I found the solution, and I post here to make sure if someone have the same issue with me, and you can try this solution, it works for me, and maybe you too !

Step1 : open the AppDelegate.cpp

Step2 : make your code like below


// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground()
{
    CCDirector::sharedDirector()->stopAnimation();
    CCDirector::sharedDirector()->pause();

// if you use SimpleAudioEngine, it must be pause
CocosDenshion::SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
}

// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
    CCDirector::sharedDirector()->stopAnimation();
    CCDirector::sharedDirector()->resume();
    CCDirector::sharedDirector()->startAnimation();

// if you use SimpleAudioEngine, it must resume here
CocosDenshion::SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
}

Step3 : re-compile and run it

And that's all !!!

Hope you will enjoy your coding time !!!

Wednesday, May 16, 2012

MapRecord 3.0 is now coming !!!



Download Link:MapRecord 3.0 on App Store!

謝謝大家的捧場…MapRecord終於迎來了3.0的更新…此次更新了不少東西…詳列如下…還請各位新雨舊知記得更新啊…小弟叩謝…

★★★★★ 感謝大家的支持!新功能強力改版推出!

1. 改善錄影效率 - 支援最新的iOS5錄影,大幅減少lag的狀況!
2. 增加facebook、twitter分享功能以及可轉存至內建的照片庫 - 可以錄影畫面單格輸出,分享給好友,或是警察杯杯^_^!
3. 保留循環錄影段落 - 重要錄影畫面可立刻保留,不怕被循環錄影功能蓋掉。
4. 強化手勢操作 - 二指雙擊可開始/停止錄影,二指滑動可保留循環錄影片段,雙指可放大以及縮小地圖!
5. bug修正以及UI加強

PS:iPhone錄影時會產生高熱,請將機器放置於通風良好處以及將機體露出散熱,以免熱當。

Thanks for your support, MapRecord 3.0 finally comes out to App Store. There are several big things update, please don't forget to get your latest update version.

★★★★★ Thank you for your support! All new features are here for you!

1. Improve recording efficiency - Supports latest new iOS5 recording features, give you the smoothly video recording experience ever and never!
2. Facebook, Twitter sharing and save to Camera Roll features - You can save a whole video or a "Single Frame" of video, and share them to your friends!
3. Keeping a section of cycling videos - Instantly keep your cycling video clips, no afraid of overwriting them!
4. Improved gestures - Double taps with two fingers makes Start/Stop recording! Swiping with two fingers makes Keeping an recording clip! Two finger to zoom in/out maps!
5. Some bugs fix, and UI improve.

PS: When recording, to avoid that iPhone becoming over-heating! Please set device on a well ventilated place, and make it's body exposed for radiating the heat.