Sharedwww / talks / 2006-05-09-sage-digipen / tutorial / pudding-meter-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
import pudding.ext.meter
9
10
soya.init()
11
soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))
12
13
# initialise pudding
14
pudding.init()
15
16
scene = soya.World()
17
18
sword_model = soya.Shape.get("sword")
19
sword = soya.Volume(scene, sword_model)
20
sword.x = 1
21
sword.rotate_lateral(90.)
22
23
# one line rotation :)
24
sword.advance_time = lambda p: sword.rotate_lateral(5.*p)
25
26
light = soya.Light(scene)
27
light.set_xyz( .5, 0., 2.)
28
29
camera = soya.Camera(scene)
30
camera.z = 3.
31
32
soya.set_root_widget(pudding.core.RootWidget())
33
34
meter = pudding.ext.meter.Meter(soya.root_widget, min=0, max=100,
35
left=10, top=10, width=100, height=20)
36
meter.border_color = (1, 1, 1, 1)
37
38
# meterplus = pudding.ext.meter.MeterPlus(soya.root_widget, "health:",
39
# top = 10, width = 200,
40
# height = 20)
41
# meterplus.set_pos_bottom_right(right = 10)
42
# meterplus.anchors = pudding.ANCHOR_TOP_RIGHT
43
# meterplus.meter.border_color = (1, 1, 1, 1)
44
# meterplus.label.color = meterplus.meter.border_color
45
46
soya.root_widget.add_child(camera)
47
48
pudding.idler.Idler(scene).idle()
49
50