setFPS method

void setFPS(
  1. int newFPS
)

Changes the target FPS backend renders at.

No-op if newFPS equals the current fps. Otherwise updates backend's target FPS, then notifies the app about the FPS change and emits EventFPSChanged with the old and new values.

Implementation

void setFPS(int newFPS) {
  if (newFPS == _fps) return;
  app.backend.setTargetFPS(newFPS);
  int oldFPS = _fps;
  _fps = newFPS;
  app._doFPSChange(oldFPS, newFPS);
  app.emit(EventFPSChanged(app, oldFPS, newFPS));
}