Here’s a Ball
http://pastebin.java-gaming.org/ee082069919
In my game loop code, the throttling mechanic is simply an ‘entity’ and not part of the main loop. To me it makes sense to implement that outside of the main loop as that gives you the opportunity to swap out different throttling strategies, even in runtime.
For example, cut-scenes may require a hard-vsync’ed 30FPS, while during gameplay you might prefer to target 60fps and allow some screen tearing if things get hectic.
(sorry for necro-ing an old thread)