Game Development Community

iPod Screen Dims when not Touched

by Chris Jorgensen · in iTorque 2D · 12/08/2009 (1:44 am) · 6 replies

I believe there's a solution for this already posted, but I can't find it. The glitch is that if I don't actually touch the iPod screen, the screen will fade (presumably some sort of idle battery saver). How do I disable this?

#1
12/08/2009 (11:02 am)
This should disable sleep mode and screen dimming:
[UIApplication sharedApplication].idleTimerDisabled = YES;
#2
12/08/2009 (12:53 pm)
Thanks. It was that keyword "idle" that I couldn't remember!
#3
12/11/2009 (8:51 pm)
Where do you place this code? I take it not in any script.
#4
12/11/2009 (9:54 pm)
No, that's ObjC. Stick it anywhere early in the platform-specific code. The main() function would be an excellent spot.
#5
12/11/2009 (10:29 pm)
Thanks I thought as much, shouldn't that be like automatic? Who really wants their game dimming?

#6
12/11/2009 (10:46 pm)
The game dims if you haven't touched the screen in a while. A purely accelerometer-based game would need that option toggled, but a game with frequent need to touch the screen won't dim.