Fix #79: throttle to target framerate properly

Decouple FPS computation and framerate targetting: simply sleep() each
frame if we finished too early, regardless of the observed framerate.
This removes fluctuations between sleeping because of FPS and sleeping
affecting the FPS itself.

Also fix framerate and EMA computation, now they produce correct
results using floating-point ema.