How to set FPS limit?

39 views
Skip to first unread message

smallrice388

unread,
Dec 17, 2017, 12:31:08 PM12/17/17
to cocos2d discuss
I am new to use cocos 2d python and I face a problem now: I want to limit the FPS below 30, but it seems that the python cocos2d framework doesn't provide the interface to limit the FPS. Does anyone know how to solve this problem? Thanx in advance!

My code framework is as follow:

# -*- coding: utf-8 -*-
import cocos
import pyglet
from cocos.actions import *
from cocos.director import *
from cocos.scene import *
from game_controller import *
import common

def main():
    #initialize director
    director.init( width=common.visibleSize["width"], height=common.visibleSize["height"], caption="Flappy Bird")

    #turn off display FPS
    #director.show_FPS = True

    #run
    gameScene = Scene()
    game_start(gameScene)

    if director.scene:
        director.replace(gameScene)
    else:
        director.run(gameScene)

Bastien Sevajol

unread,
Dec 21, 2017, 9:14:03 AM12/21/17
to cocos2d discuss
You should take a look around pyglet instead cocos2d for fps limitation. Answer example: https://stackoverflow.com/a/14735825/801924
Reply all
Reply to author
Forward
0 new messages