FPS Controlled

I had an idea to control the framerate of app based on Simple Game.



My code:

public class Prueba extends SimpleGame{
   
   private Timer timeFPS = new Timer();
   private TimerTask tt = new TimerTask(){
      public void run(){
         scanProcess();
      }
   };
   
   /**
    * @param args
    */
   public static void main(String[] args) {
      Prueba app = new Prueba();
      app.setDialogBehaviour(SimpleGame.ALWAYS_SHOW_PROPS_DIALOG);
      app.start();
   }

   protected void scanProcess() {
      for(int i=0; i<ProcessManager.getProcessNumber(); i++)
         ProcessManager.processAt(i).frameAction();
   }

   @Override
   protected void simpleInitGame() {
      Cubo c = new Cubo(rootNode);      
   }

   @Override
   protected void simpleUpdate() {
      try {
         timeFPS.scheduleAtFixedRate(tt,16,16);
      } catch (IllegalStateException e) {}   
      super.simpleUpdate();
   }   
}



The method scanProcess goes through a list of objects. (In my case, a simple cube that rotates).

What do you think about this method?

Interesting, but wouldn't this only update at a fixed rate, not change the FPS?  Also, now you run into threading issues…

I understand, but I'm going to try this method as long as posible.