I am trying to write some skeleton for a game on android, using OpenGL. I would like to know, where should I place my main game loop code?
So far, my best candidate is Renderer.onDrawFrame(...) method, which seems to be called per-frame, so the code looks like this:
void onDrawFrame(GL10 gl)
{
preLoopActions();
m_gameScene->onUpdate();
m_gameScene->onRender(gl);
postLoopActions();
}
Is there any better approach? I dislike this one because 1) I have to mix updating and rendering in the place, where android expects me just to render, and 2) this method seems to be called from a separate "rendering thread", which increases game complexity.