Could you suggest an implementation of a game loop with interpolation for SurfaceView and thread?
i have this, but it doesnt work.
while( running ) {
Canvas canvas = null;
loops = 0;
while (System.currentTimeMillis() > next_game_tick
&& loops < MAX_FRAMESKIP) {
player.getInfo(towardPointX, uiClicked);
Collision(all_cars);
running = player.isGameOn();
next_game_tick += SKIP_TICKS;
loops++;
}
interpolation = (System.currentTimeMillis() + SKIP_TICKS - next_game_tick
/ (double) SKIP_TICKS);
background1.update(interpolation);
moveCars(all_cars, interpolation);
canvas = surfaceHolder.lockCanvas();
background1.draw(canvas);
canvasDraw(canvas,all_cars);
surfaceHolder.unlockCanvasAndPost(canvas);
}}}
```