Skip to content

Instantly share code, notes, and snippets.

@florczakraf
Created August 15, 2016 13:53
Show Gist options
  • Select an option

  • Save florczakraf/76bd4adb3df3e13caedf7d1d1338164b to your computer and use it in GitHub Desktop.

Select an option

Save florczakraf/76bd4adb3df3e13caedf7d1d1338164b to your computer and use it in GitHub Desktop.
getCjFPS(fps)
{
delta = 15;
for (i = 0; i < level.cj_fps.size; i++)
{
cj_fps = int(level.cj_fps[i]);
if (isValueCloseToDesired(fps, cj_fps, delta))
return cj_fps;
}
return fps;
}
isValueCloseToDesired(value, desired, delta)
{
return abs(desired - value) <= delta;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment