Android and logical flows

On the Android platform, how would you separate visualization from logic? I can get the base class of custom threads executing the drawing, but what I don't get is where the logic update can be added. While doing some research, I think it would be better to use two different streams, one for each, rendering and logical update. All I can think of atm is update with onDraw in the same thread. Any pointers to tutorials or some ideas on this would be greatly appreciated, thanks.

+3
source share
1 answer

I developed one of the most downloaded games on the Android market, but 2 years have already passed, so this solution may be outdated. I did this: - use the View object as the content view - override the draw () method of this class of View objects - at the end of the draw () method, call doLogic ()

Note that both the rendering call and doLogic () occur in the main thread. It sounds no-no, but it works for most games (and gives you automatic synchronization without the need for complication).

+2
source

Source: https://habr.com/ru/post/1779952/


All Articles