~facundo/enjuewemela/trunk

« back to all changes in this revision

Viewing changes to enjuewemela/cocos/doc/programming_guide/skeleton/show_root_bone.py

  • Committer: facundo at com
  • Date: 2010-11-20 01:42:31 UTC
  • mfrom: (62.1.3 lint-issues)
  • Revision ID: facundo@taniquetil.com.ar-20101120014231-b2tkyc3mwr84ggcc
Project reorder and lint issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# This code is so you can run the samples without installing the package
2
 
import sys
3
 
import os
4
 
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../../..'))
5
 
#
6
 
 
7
 
## import all the stuff we need from cocos
8
 
import cocos
9
 
from cocos.director import director
10
 
from cocos.sprite import Sprite
11
 
from cocos import skeleton
12
 
 
13
 
# import the skeleton we have created
14
 
import root_bone
15
 
 
16
 
class TestLayer(cocos.layer.Layer):
17
 
    def __init__(self):
18
 
        super( TestLayer, self ).__init__()
19
 
 
20
 
        x,y = director.get_window_size()
21
 
        
22
 
        # create a ColorSkin for our skeleton
23
 
        self.skin = skeleton.ColorSkin(root_bone.skeleton,
24
 
                                        (255,0,0,255))
25
 
        
26
 
        # add the skin to the scene
27
 
        self.add( self.skin )
28
 
        x, y = director.get_window_size()
29
 
        self.skin.position = x/2, y/2
30
 
   
31
 
    
32
 
if __name__ == "__main__":
33
 
    # usual cocos setup
34
 
    director.init()
35
 
    test_layer = TestLayer()
36
 
    bg_layer = cocos.layer.ColorLayer(255,255,255,255)
37
 
    main_scene = cocos.scene.Scene()
38
 
    main_scene.add(bg_layer, z=-10)
39
 
    main_scene.add(test_layer, z=10)
40
 
    director.run(main_scene)