MichaelD Posted November 15, 2015 Share Posted November 15, 2015 Hello, I'm looking for a way to enforce the least amount of updates and render, I have two buttons that only change their state (up, down). and a timer that sends the status of these buttons. So I'm looking for a way to conserve power because if I have the app running even with a charger attached it manages to run out my battery. Anything I can do to reduce the amount of battery the app is using? Thanks. Link to comment Share on other sites More sharing options...
bruno_ Posted November 15, 2015 Share Posted November 15, 2015 I don't know if I fully understand your question, but if you only have two buttons and a status event, you can you use plain HTML/JS/CSS with two buttons and onclick events. Link to comment Share on other sites More sharing options...
icp Posted November 15, 2015 Share Posted November 15, 2015 The easy way would be to use this:this.game.time.desiredFps = 5;The other way would be to create a main timer and use it to run updates instead of the update method. Link to comment Share on other sites More sharing options...
MichaelD Posted November 15, 2015 Author Share Posted November 15, 2015 The desiredFps doesn't seem to work, I still get 60 FPS I'm also running Phaser.HEADLESS to stop any rendering. The html/css solution is not viable because I'm using other parts of Phaser Link to comment Share on other sites More sharing options...
drhayes Posted November 16, 2015 Share Posted November 16, 2015 I think you'd have to manually run the update loop yourself, stop letting Phaser call it via requestAnimationFrame. Check out Phaser.Game#enableStep and disableStep for updating the game loop manually. MichaelD 1 Link to comment Share on other sites More sharing options...
Skeptron Posted November 17, 2015 Share Posted November 17, 2015 I've seen lots of people complaining about desiredFps not working, but for me it has always worked like a charm. ? Link to comment Share on other sites More sharing options...
stupot Posted November 17, 2015 Share Posted November 17, 2015 I tried desiredFPS once maybe 8 months ago, it was definitely not working as expected, I looked into the code and it was flawed and broken at that time. The problem showed itself when you targetted a low value on a device that was already struggling. Link to comment Share on other sites More sharing options...
Recommended Posts