Keep lights on on iPod
by Muthuraja · in iTorque 2D · 07/21/2009 (9:25 pm) · 5 replies
It's me again. I make a game using the accelerometer. This game doesn't need any touch after the play button touch. After 30 seconds iPod turns the lights off. How to keep them on? Help me....
About the author
Sirpi Software Pvt Ltd
#2
@muthuraja: Did you buy iTGB and get a problem with the user account, or are you stealing?
07/24/2009 (9:19 pm)
@Dave: The correct way is setting the idletimer off in the shared application. I hope this is in the next iTGB release.@muthuraja: Did you buy iTGB and get a problem with the user account, or are you stealing?
#3
Shouldn't be too hard to add a #define that defines if the game is accelerometer driven or not to watch the idletimer.
Buuut... Technically, if the idletimer is off, then the device will never go to sleep, which is no good. So really, shouldn't the idletimer be integrated to be reset by accelerometer actions if the game is acceleromete driven?
07/24/2009 (9:32 pm)
Ah! Right, that was it! My bad... I knew I had seen how to but had not implmented it.Shouldn't be too hard to add a #define that defines if the game is accelerometer driven or not to watch the idletimer.
Buuut... Technically, if the idletimer is off, then the device will never go to sleep, which is no good. So really, shouldn't the idletimer be integrated to be reset by accelerometer actions if the game is acceleromete driven?
#4
It's easier to just toggle the idletimer depending on mode, as suggested in "iPhone Application Programming Guide", page 22.
Since the idletimer is fairly short by default, all games should disable it while in playmode. An example would be one of the defensive games where you build units, then sit around for ages while your troops/towers clobber the waves of enemies. If they don't do anything with the timer, the screen dims, and eventually it falls asleep, while you're technically playing.
What iTGB needs is an actual pause/unpause function (like Cocos2D has) which both toggles the idletimer and sets updates to happen less frequently.
So at gamestart and unpause:
...then set it back to NO when pausing/leaving back to the menus. iPhoneMain.mm or thereabouts should have some function calls you can stick this line in.
07/25/2009 (11:16 am)
No, the accelerometer should never have anything to do with the idletimer. For games, you should enable the idletimer when in pausemode, for example. The accelerometer ALWAYS has changing values, unless you are a robot living far away from Japan or California ;)It's easier to just toggle the idletimer depending on mode, as suggested in "iPhone Application Programming Guide", page 22.
Since the idletimer is fairly short by default, all games should disable it while in playmode. An example would be one of the defensive games where you build units, then sit around for ages while your troops/towers clobber the waves of enemies. If they don't do anything with the timer, the screen dims, and eventually it falls asleep, while you're technically playing.
What iTGB needs is an actual pause/unpause function (like Cocos2D has) which both toggles the idletimer and sets updates to happen less frequently.
So at gamestart and unpause:
[UIApplication sharedApplication].idleTimerDisabled = YES;
...then set it back to NO when pausing/leaving back to the menus. iPhoneMain.mm or thereabouts should have some function calls you can stick this line in.
#5
(And I very well may be a robot living far from Japan or California. I can keep my hands still enough to crack an atom open like an egg!)
07/25/2009 (12:26 pm)
Okay, yes, that I can agree with. See, I was working off the logic that I'm not sure if Apple will approve a game that does not go into sleep mode. But then, I know there are non-jailbreak apps that prevent the sleep mode from activating, so I guess that is fine after all. So what you say then makes sense - disable it while in actual playmode, re-enable it while in menus or when your actual game is paused.(And I very well may be a robot living far from Japan or California. I can keep my hands still enough to crack an atom open like an egg!)
Associate Dave Calabrese
Cerulean Games
Also - why are you asking questions about iTGB without having purchased a license for the engine? Please purchase the engine if you want to continue to receive support and assistance. Otherwise, don't expect many people to help you, and if you do release a game, I wouldn't be surprised if you get in some legal trouble and Apple is forced to pull the kill switch on your product, which removes it from every device it is installed on.