当我cocos2d(python)
从终端在 mac pro 中运行 hello 示例时,我使用 sudo,但没有 UI 显示,没有警告没有错误,我错过了什么?
当我第一次运行我的 MacPro x64 时它运行良好,但后来我重新安装了一些软件包,但它不是。我想也许pyglet 的 1.1.4 版本不支持 x64,但我不太确定。
#
# cocos2d
# http://cocos2d.org
#
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
import cocos
class HelloWorld(cocos.layer.Layer):
def __init__(self):
super( HelloWorld, self ).__init__()
# a cocos.text.Label is a wrapper of pyglet.text.Label
# with the benefit of being a cocosnode
label = cocos.text.Label('Hello, World!',
font_name='Times New Roman',
font_size=32,
anchor_x='center', anchor_y='center')
label.position = 320,240
self.add( label )
if __name__ == "__main__":
# director init takes the same arguments as pyglet.window
cocos.director.director.init()
# We create a new layer, an instance of HelloWorld
hello_layer = HelloWorld ()
# A scene that contains the layer hello_layer
main_scene = cocos.scene.Scene (hello_layer)
# And now, start the application, starting with main_scene
cocos.director.director.run (main_scene)
# or you could have written, without so many comments:
# director.run( cocos.scene.Scene( HelloWorld() ) )