Setting framerate

Setting framerate
0.0 0


I want to lower the frame rate in cocos2d-x 3.0 to 30 fps. On iOS it works just fine but when it comes to android the game is still running at ~60 fps instead of the 30 fps, which I set in the AppDelegate.
Is there anything I must do to get it work on android?


Look on forum. On android code responsible for FPS is comented. Check file ? Look for it.


My look like this:

	public void onDrawFrame(final GL10 gl) {

		long lastTime = System.currentTimeMillis();
		lastTime = System.currentTimeMillis() - startTime;
		if (lastTime < Cocos2dxRenderer.sAnimationInterval) {
			try {
				Thread.sleep(Cocos2dxRenderer.sAnimationInterval - lastTime);
			} catch (InterruptedException e) {
		startTime = System.currentTimeMillis();


And Cocos2dxRenderer.sAnimationInterval is defined as this:

private static long sAnimationInterval = (long) (1.0 / 60 * Cocos2dxRenderer.NANOSECONDSPERSECOND);


Thanks for your help, but in cocos2d-x 3.0 there is no thats why i can’t use the solution for this problem.


Hi guys,

I’m just starting my first Android port and I’ve run into the same problem. I’m using Cocos2d-x 3 frame rate isn’t being limited to 30 like it should be.

As Sebastian says, the doesn’t work as the file doesn’t exist on Cocos2d-x 3.

Has anyone found a work around for this yet?