Author: ArcRiley
Date: 2007-12-30 18:29:52 +0000 (Sun, 30 Dec 2007)
New Revision: 636

Modified:
   trunk/pysoy/examples/collide_blocks.py
   trunk/pysoy/src/controllers/Keyboard.pxi
   trunk/pysoy/src/controllers/soy.controllers.pxd
   trunk/pysoy/src/controllers/soy.controllers.pyx
Log:
continued work on #897, pageup/pagedown now control depth of blue block


Modified: trunk/pysoy/examples/collide_blocks.py
===================================================================
--- trunk/pysoy/examples/collide_blocks.py      2007-12-30 17:48:28 UTC (rev 
635)
+++ trunk/pysoy/examples/collide_blocks.py      2007-12-30 18:29:52 UTC (rev 
636)
@@ -5,6 +5,7 @@
 
 sce = soy.Scene()
 cam = soy.bodies.Camera(sce)
+cam.shape=soy.shapes.Sphere(2)
 cam.position = (0.0, 0.0, 10.0)
 lig = soy.bodies.lights.Light(sce)
 lig.position = (-10.0,10.0,2.0)
@@ -17,15 +18,14 @@
 win = soy.Window(scr, 'Collision Blocks', background=soy.colors.Teal())
 pro = soy.widgets.Projector(win, camera=cam)
 key = soy.controllers.Keyboard(win)
-pushl = soy.actions.Force(bks['teal'], -100,    0, 0)
-pushu = soy.actions.Force(bks['teal'],    0,  100, 0)
-pushr = soy.actions.Force(bks['teal'],  100,    0, 0)
-pushd = soy.actions.Force(bks['teal'],    0, -100, 0)
-key['Q'] = pushl
-key['R'] = pushu
-key['S'] = pushr
-key['T'] = pushd
+key['Q'] = soy.actions.Force(bks['teal'], -100,    0,    0)
+key['R'] = soy.actions.Force(bks['teal'],    0,  100,    0)
+key['S'] = soy.actions.Force(bks['teal'],  100,    0,    0)
+key['T'] = soy.actions.Force(bks['teal'],    0, -100,    0)
+key['U'] = soy.actions.Force(bks['teal'],    0,    0, -100)
+key['V'] = soy.actions.Force(bks['teal'],    0,    0,  100)
 
+
 if __name__ == '__main__' :
   while True:
     sleep(.1)

Modified: trunk/pysoy/src/controllers/Keyboard.pxi
===================================================================
--- trunk/pysoy/src/controllers/Keyboard.pxi    2007-12-30 17:48:28 UTC (rev 
635)
+++ trunk/pysoy/src/controllers/Keyboard.pxi    2007-12-30 18:29:52 UTC (rev 
636)
@@ -31,9 +31,15 @@
     self._window._controllers.unlock()
 
   def __dealloc__(self) :
+    cdef int _i
     self._window._controllers.lock()
     self._window._controllers.remove(<void *>self)
     self._window._controllers.unlock()
+    for i from 0 <= i < 256 :
+      if self._acts_keycde[i] :
+        py.Py_DECREF(<soy.actions.Action> self._acts_keycde[i])
+      if self._acts_keysym[i] :
+        py.Py_DECREF(<soy.actions.Action> self._acts_keysym[i])
 
   def __repr__(self) :
     return '<Keyboard>'
@@ -56,7 +62,10 @@
     if not isinstance(value, soy.actions.Action) :
       raise TypeError('value not an instance of soy.actions.Action')
     if type(key) == str and len(key)==1 :
+      if self._acts_keysym[ord(key)] :
+        py.Py_DECREF(<soy.actions.Action> self._acts_keysym[ord(key)])
       self._acts_keysym[ord(key)] = <void *> value
+      py.Py_INCREF(<soy.actions.Action> self._acts_keysym[ord(key)])
 
   cdef void _eventKeyDown(self, unsigned char _cde, unsigned char _sym) :
     if self._acts_keycde[_cde] :

Modified: trunk/pysoy/src/controllers/soy.controllers.pxd
===================================================================
--- trunk/pysoy/src/controllers/soy.controllers.pxd     2007-12-30 17:48:28 UTC 
(rev 635)
+++ trunk/pysoy/src/controllers/soy.controllers.pxd     2007-12-30 18:29:52 UTC 
(rev 636)
@@ -17,7 +17,6 @@
 #
 # $Id$
 
-cimport stdio
 cimport soy._core
 cimport soy._internals
 cimport soy.actions

Modified: trunk/pysoy/src/controllers/soy.controllers.pyx
===================================================================
--- trunk/pysoy/src/controllers/soy.controllers.pyx     2007-12-30 17:48:28 UTC 
(rev 635)
+++ trunk/pysoy/src/controllers/soy.controllers.pyx     2007-12-30 18:29:52 UTC 
(rev 636)
@@ -23,6 +23,7 @@
               'by '+'$Author$'[9:-2]
 __version__ = 'Trunk (r'+'$Rev$'[6:-2]+')'
 
+cimport py
 cimport stdio
 
 include "Controller.pxi"

_______________________________________________
PySoy-SVN mailing list
PySoy-SVN@pysoy.org
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to