Skip to content

Commit f975c1f

Browse files
committed
- very simple helloWorld example
1 parent 9ff9095 commit f975c1f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

helloWorld.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env python3
2+
3+
import cocos
4+
5+
class HelloWorld(cocos.layer.Layer):
6+
def __init__(self):
7+
super(HelloWorld, self).__init__()
8+
label = cocos.text.Label('Hello, world', font_name='Times New Roman', font_size=32, anchor_x='center', anchor_y='center')
9+
label.position = 320, 240
10+
self.add(label)
11+
12+
def main():
13+
cocos.director.director.init()
14+
hello_layer = HelloWorld()
15+
main_scene = cocos.scene.Scene(hello_layer)
16+
cocos.director.director.run(main_scene)
17+
18+
if __name__ == '__main__': main()

0 commit comments

Comments
 (0)