android - Syncing UI Thread and workhorse thread -
hi have 1 thread uses surfaceview draw screen thread updating positions of objects on screen. how make these run @ same speed?
there trade off:
- you want update screen sufficiently motion appears smooth.
- you want give cpu possible workhorse thread
the easy solution this:
- the work horse thread sets flag indicating when there has been change worthy of redraw.
the ui thread has flow bit this
do { renderscreen(); while (!screenneedsredrawing) { thread.sleep(10); } }
Comments
Post a Comment