[英]cocos2d python can't show UI in mac
When I run cocos2d(python)
hello example in mac pro from terminal ,I use sudo ,but no UI show ,no warning no error, what I missed? 当我从终端在Mac Pro中运行
cocos2d(python)
hello示例时,我使用sudo,但没有显示UI,没有警告没有错误,我错过了什么?
Its work well when I first run my MacPro x64, but later I reinstall some packages, it not. 当我第一次运行MacPro x64时,它运行良好,但后来我重新安装了一些软件包,但不是。 I thinks maybe the pyglet's 1.1.4 version can't support x64 , but i am not very sure.
我认为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() ) )
On Mac OSX Mavericks it works using sudo. 在Mac OSX Mavericks上,它使用sudo可以工作。 Without sudo I had the same problem.
没有须藤我有同样的问题。
sudo python samples/hello_world.py sudo python示例/ hello_world.py
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.