Playbook: cocos2dx + marmalade : game pause

hello

I am working on a game to be released on Blackberry Playbook using Coocs2dx (1.0.1-x-0.13.0-beta) and Marmalade (5.2).
Almost done with the game…only a last few glitches i am stuck with and would like if someone could help me out with this.

for pausing my in-game I am using
cocos2d::CCDirector::sharedDirector()->pause()
cocos2d::CCDirector::sharedDirector()->resume()
which is working fine

but there are events when I would like to get my game paused, like…

  1. The standby timeout set on the playbook device is ON, so after for eg. 1 minute the backlight turns off and the device is on standby mode.
    so is there a way or event that i could get at this point to pause my game when the device is on standby mode. (also in standby mode the FPS drops to 1 or 2 fps)

  2. one of the ways, if a user using the playbook wants to close the app, he has to slide/swipe up so the app gets minimized and then he can close it or let it run in the background.
    currently, my game gets minimized, but is still running in the minimized state…what i am looking for is that the game should get minimized and also get paused along with that.

Also i would like to mention that the functions applicationDidEnterBackground and applicationWillEnterForeground are not getting called, i was kind of hoping if these functions got called while minimizing, then the app would have gone in the paused state.

Also, i tried using s3eDeviceRegister(S3E_DEVICE_NOTIFY_PAUSE,(s3eCallback)CMenuScene::pauseCallback, NULL) which works on the simulator when i trigger it manually through (events->simulate suspend)
but not on the device.

Any suggestions would be of great help.
Thank you

Hi,

I have the same problem (functions applicationDidEnterBackground and applicationWillEnterForeground are not getting called)! But it would be great if they were available for getting called.

It would be greatful, if anyone can help with handling application minimize with this way or through another one.

Thanks in advance!

Hi,
I m using the folliowing code -

s3eDeviceRegister(S3E_DEVICE_PAUSE, PauseCallback, 0);
s3eDeviceRegister(S3E_DEVICE_UNPAUSE, UnPauseCallback, 0);

static int PauseCallback(void* systemData, void* userData)
{
CCDirector::sharedDirector()->stopAnimation();
CCDirector::sharedDirector()->pause();
return 0;
}
static int UnPauseCallback(void* systemData, void* userData)
{

CCDirector::sharedDirector()->resume();
CCDirector::sharedDirector()->startAnimation();
return 0;
}

Is this useful to you ???

chetan rana,

thank you so much! your method does work both on the marmalade simulator and the device!

Only one question has left: will these callbacks be getting called due to incoming phone call rather than minimize button pressing?

Thanks in advance!

Hi.

According to marmalade docs,

S3E_DEVICE_PAUSE allows you to create a callback when the user application has been suspended, for example during a phone call or when the application has lost focus.

Ok, I got it. Thanks again!