Author: ArcRiley
Date: 2008-01-04 06:43:41 +0000 (Fri, 04 Jan 2008)
New Revision: 739
Modified:
games/blockdropper/core.py
games/blockdropper/well.py
Log:
some updates from Soya3D to PySoy
Modified: games/blockdropper/core.py
===================================================================
--- games/blockdropper/core.py 2008-01-03 21:18:32 UTC (rev 738)
+++ games/blockdropper/core.py 2008-01-04 06:43:41 UTC (rev 739)
@@ -1,9 +1,9 @@
# Blockdropper core.py
-# Copyright (C) 2005 Arc Riley
+# Copyright (C) 2005,2008 Arc Riley
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@@ -15,48 +15,31 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import sys, os, os.path, soya, soya.widget
-import blocks, controller, well
+import sys, os, os.path, soy
+import blocks, well
-class RootWidget(soya.widget.Group) :
- def __init__(self) :
- soya.widget.Group.__init__(self)
- self.controller = controller.Controller()
-
- def widget_begin_round(self) :
- self.controller.begin_round()
- soya.widget.Group.widget_begin_round(self)
+screen = soy.Screen()
+window = soy.Window(title="BlockDropper", size=(512, 600))
+scene = soy.Scene()
-soya.init("BlockDropper", 512, 600, False, False)
-soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))
-soya.set_root_widget(RootWidget())
-scene = soya.World()
-
-
-class cubic(soya.World) :
- def begin_round(self) :
- self.rotate_lateral(1.0)
- self.rotate_vertical(.5)
-
mywell = well.TroWell(scene)
cubes = cubic(scene)
cubes.z = 50.0
cube1 = soya.Volume(cubes, blocks.blocks['teal'])
-cube1.set_xyz(-.5, -.5, -.5)
+cube1.position(-.5, -.5, -.5)
cube2 = soya.Volume(cubes, blocks.blocks['rose'])
-cube2.set_xyz(.5, -.5, -.5)
+cube2.position(.5, -.5, -.5)
cube3 = soya.Volume(cubes, blocks.blocks['jade'])
-cube3.set_xyz(.5, .5, -.5)
+cube3.position(.5, .5, -.5)
cube4 = soya.Volume(cubes, blocks.blocks['gold'])
-cube4.set_xyz(.5, .5, .5)
+cube4.position(.5, .5, .5)
# Creates a light in the scene (same convention: the first argument of the
# constructor is the parent) and moves it to (1.5, 2.0, 0.2).
-light = soya.Light(scene)
-light.set_xyz(0.5, 0.0, 2.0)
-light.directional = 1
+light = soy.bodies.lights.Light(scene)
+light.position(0.5, 0.0, 2.0)
#light.diffuse = (1.0, 0.8, 0.4, 1.0)
#light.rotate_vertical(-45.0)
@@ -68,15 +51,6 @@
# (Using -Z for front seems odd, but using Z for front makes all coordinate
systems
# indirect, which is a mathematical nightmare !)
-camera = soya.Camera(scene)
-camera.z = 2.0
+camera = soy.bodies.Camera(scene)
+camera.position = (0,0,2.0)
camera.fov = 90.0
-
-# Say to Soya that the camera is what we want to be rendered.
-
-soya.root_widget.add(camera)
-
-#soya.render();
soya.screenshot().save(os.path.join(os.path.dirname(sys.argv[0]), "results",
os.path.basename(sys.argv[0])[:-3] + ".jpeg"))
-
-soya.Idler(scene).idle()
-#soya.render()
Modified: games/blockdropper/well.py
===================================================================
--- games/blockdropper/well.py 2008-01-03 21:18:32 UTC (rev 738)
+++ games/blockdropper/well.py 2008-01-04 06:43:41 UTC (rev 739)
@@ -1,9 +1,9 @@
# Blockdropper :: Well Classes (well.py)
-# Copyright (C) 2006 Arc Riley
+# Copyright (C) 2006,2008 Arc Riley
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
@@ -15,7 +15,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import soya
+import soy
import blocks
import random
_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn