File: pudding-image-1.py

package info (click to toggle)
soya-doc 0.14-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 15,264 kB
  • ctags: 1,039
  • sloc: python: 4,334; makefile: 9; sh: 5
file content (46 lines) | stat: -rw-r--r-- 932 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- indent-tabs-mode: t -*-

#!/usr/bin/env python

import sys, os

import soya
import soya.pudding as pudding

soya.init(width = 640, height = 480)
soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))

# initialise pudding
pudding.init()

scene = soya.World()

sword_model = soya.Model.get("sword")
sword = soya.Body(scene, sword_model)
sword.x = 1
sword.rotate_y(90.)

# one line rotation :)
sword.advance_time = lambda p: sword.rotate_y(5.*p)

light = soya.Light(scene)
light.set_xyz( .5, 0., 2.)

camera = soya.Camera(scene)
camera.z = 3.

w = pudding.core.RootWidget(width = 640,height = 480)

mypic = soya.Material( soya.Image.get('grass.png'))

grass = pudding.control.Image(w, mypic, left=0, top = 0, width = 320, height=480)
grass.anchors = pudding.ANCHOR_ALL

logo = pudding.control.Logo(w, 'little-dunk.png')

w.add_child(camera)

soya.set_root_widget(w)

pudding.main_loop.MainLoop(scene).main_loop()