package bogue

  1. Overview
  2. Docs

Time in msec.

Dependency graph
type t = int
val now : unit -> t

Time elapsed from the initialization of SDL (roughly, since the start of your program).

val adaptive_fps : int -> (unit -> unit) * (unit -> unit)

Create helper functions to help controlling the frame rate of the graphics loop. This is only useful if you have your own graphics loop, and do not use Main.run.

adaptive_fps 60 returns two functions start,fps. The statement start () will start the timing. At each iteration of your loop, you should call fps (), which will try to sleep long enough to achieve the desired 60FPS rate. It works on average: if some frames take longer, it will shorten the next frame to keep up. However, it tries to be nice to the CPU: even if one is really too slow, it will guarantee a 5ms sleep to the CPU and not try to keep up.