Android – saves battery by not painting each render call
I think there must be a simple solution, which I ignored. I think one option is framebuffer, but I'm not sure whether it is the best
I'm developing a puzzle game that requires intensive calculation when drawing. When updating the screen, I do as much calculation as possible, but some of them I can't or will be very troublesome to get rid of. On the other hand, most of the time, users will see the screen when trying to find the next action, and the screen will display a still image. Therefore, Running rendering code 60 times per second is just a waste of battery
What is the easiest way to prevent drawing without changes in the model? Is there any way to tell libgdx to temporarily stop calling rendering when displaying the last rendered image, or is there a virtual screen in which I can draw and then draw it on the screen?
As I said, I know framebuffer, but it seems that this object means something more complex than I want to implement
resolvent:
Use discontinuous rendering and only render on demand
The most basic thing is to put it in oncreate()
Gdx.graphics.setContinuousRendering(false);
Gdx.graphics.requestRendering();
Then, in your code, requestrendering() is called whenever a new frame is needed (for example, in response to user input, or continuously when an animation occurs)
Whenever an input operation occurs, GDx. Graphics. Requestrendering() will be called on your behalf, so your input processor and things like that will be attacked. If they do anything in response to input, they should also be called