~facundo/enjuewemela/trunk

« back to all changes in this revision

Viewing changes to enjuewemela/cocos/test/test_camera_orbit_with_grid.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 pyglet
8
 
import cocos
9
 
from cocos.director import director
10
 
from cocos.actions import *
11
 
from cocos.layer import *
12
 
 
13
 
from pyglet.gl import *
14
 
 
15
 
 
16
 
class BackgroundLayer( cocos.layer.Layer ):
17
 
    def __init__(self):
18
 
        super( BackgroundLayer, self ).__init__()
19
 
        self.img = pyglet.resource.image('background_image.png')
20
 
 
21
 
    def draw( self ):
22
 
        glPushMatrix()
23
 
        self.transform()
24
 
        self.img.blit(0,0)
25
 
        glPopMatrix()
26
 
 
27
 
if __name__ == "__main__":
28
 
    director.init( resizable=True )
29
 
    director.set_depth_test()
30
 
 
31
 
    main_scene = cocos.scene.Scene()
32
 
 
33
 
    main_scene.add( BackgroundLayer(), z=0 )
34
 
 
35
 
    # set a 3d grid with a grid3d action
36
 
    e = WavesTiles3D( amplitude=60, waves=8, grid=(32,24), duration=8)
37
 
 
38
 
    # use the remaining grid and move it's camera
39
 
    rot = OrbitCamera( angle_x=45,  angle_z=0, delta_z=360, duration=8 )
40
 
 
41
 
    main_scene.do( e )
42
 
    main_scene.do( rot + Reverse(rot) )
43
 
 
44
 
    director.run (main_scene)