简体   繁体   English

Cocos2d Python中的FPS限制

[英]FPS limit in cocos2d python

I am new to use cocos 2d python and I face a problem now: I want to limit the FPS below 60, but it seems that the python cocos2d framework doesn't provide the interface to limit the FPS. 我是新来使用cocos 2d python的人,现在遇到一个问题:我想将FPS限制在60以下,但似乎python cocos2d框架没有提供限制FPS的接口。

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)

Does anyone know how to solve this problem? 有谁知道如何解决这个问题? Thanx in advance! 提前感谢!

You should take a look around pyglet instead cocos2d for fps limitation. 您应该查看pyglet而不是cocos2d来查看fps限制。 Answer example: https://stackoverflow.com/a/14735825/801924 答案示例: https//stackoverflow.com/a/14735825/801924

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM