Hi,

You cannot achieve more than 60 fps because of the way the UI is
sync'd with the underlying hardware. The invalidate/onDraw mechanism
can be very costly for a game if you have a deep view  hierarchy.

On Fri, Feb 27, 2009 at 1:31 PM, Markus Junginger <[email protected]> wrote:
>
> I am in the middle of writing an game and got curious what happens
> outside my code. I extended the View class with everything happing
> inside onDraw (updating the model and rendering it). Before onDraw is
> exited, a invalidate() is fired so the View gets repainted
> continously. With this approach I get 60 fps most of the time
> (sometimes it lacks behind shortly), which is OK for now. However, the
> game will get more complex, and I did some measuring with the
> following averages of painting one frame:
>
> * My code inside onDraw consumes 5ms
> * Between the calls of onDraw 10ms are "consumed"
>
> So twice the time is spend outside my code: What exactly happens here?
> Is there just a 60fps maximum (causing the system to wait until the
> next frame is painted), or is there so much overhead going on behind
> the scene?
>
> I know about SurfaceView and decoupling the rendering from the GUI
> Thread, but I haven't tried that yet. To me, it did not seem to make a
> difference in which thread my game code is executed, so I stayed with
> the View so far.
>
> Markus
> >
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to