Home button IOS phone

  • koko82
    Likes 0

    Problem Description

    Hi

    Is there a way of reseting values in cocos2dx when home button is pushed? 

  • Sonar Systems admin
    Likes 0


  • koko82
    Likes 0

    The link shows about general IOS development, is there not one associated with cocos2dx listener setup with keycode input? I’ve tried that doesnt seem to work so not sure if was missing something, or is it like the link you have provided...

  • koko82
    Likes 0

    I’ve tried that link before but only in IOS Simulator, I guess will try on phone but didnt seem to work. Looks like it doesnt mention listener for the event which you may need to set up?

  • Sonar Systems admin
    Likes 0

    What happens on phone, any logs?

  • koko82
    Likes 0

    No logs, but I do see void AppDelegate::applicationDidEnterBackground() show cclog. Unsure how to port values from current scene to reset. Can you use director for it?


  • Sonar Systems admin
    Likes 0

    Where do you see that?

  • koko82
    Likes 0

    Under AppDelegate::applicationDidEnterBackground I put in a log within that function. I saw the output on console when I pushed and resumed app. So I guess thats the way of triggering any actions, is there something in the actual game scene that does that? I want to port values in the game scene to reset but unsure how to do this..

  • Sonar Systems admin
    Likes 0

    Try creating a wrapper to communicate with it.

  • koko82
    Likes 0

    A wrapper in what sense can you provide sample code?

  • Sonar Systems admin
    Likes 0

    to be able to communicate with Objective-c code and get a response from it, within a loop so you can actively check what is happening with the home button.

  • koko82
    Likes 0

    The appdelegate is part of cocos2dx, I understand about the loop, can you provide an example?

Login to reply