Fps Cap code

This is in java, but could be useful