Sharedwww / talks / 2006-05-09-sage-digipen / tutorial / pudding-image-1.pyOpen in CoCalc
Author: William A. Stein
1
#!/usr/bin/env python
2
3
import sys, os
4
5
import soya
6
import soya.pudding as pudding
7
8
soya.init(width = 640, height = 480)
9
soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))
10
11
# initialise pudding
12
pudding.init()
13
14
scene = soya.World()
15
16
sword_model = soya.Shape.get("sword")
17
sword = soya.Volume(scene, sword_model)
18
sword.x = 1
19
sword.rotate_lateral(90.)
20
21
# one line rotation :)
22
sword.advance_time = lambda p: sword.rotate_lateral(5.*p)
23
24
light = soya.Light(scene)
25
light.set_xyz( .5, 0., 2.)
26
27
camera = soya.Camera(scene)
28
camera.z = 3.
29
30
w = pudding.core.RootWidget(width = 640,height = 480)
31
32
mypic = soya.Material( soya.Image.get('grass.png'))
33
34
grass = pudding.control.Image(w, mypic, left=0, top = 0, width = 320, height=480)
35
grass.anchors = pudding.ANCHOR_ALL
36
37
logo = pudding.control.Logo(w, 'little-dunk.png')
38
39
w.add_child(camera)
40
41
soya.set_root_widget(w)
42
43
pudding.idler.Idler(scene).idle()
44
45