Author: ArcRiley Date: 2008-03-20 03:52:22 -0400 (Thu, 20 Mar 2008) New Revision: 1189
Added: trunk/pysoy/examples/TexBlocks.py Removed: trunk/pysoy/examples/BumpBlocks.py Log: Renaming this file for windows users and their case insensitive filesystems Deleted: trunk/pysoy/examples/BumpBlocks.py =================================================================== --- trunk/pysoy/examples/BumpBlocks.py 2008-03-20 07:38:07 UTC (rev 1188) +++ trunk/pysoy/examples/BumpBlocks.py 2008-03-20 07:52:22 UTC (rev 1189) @@ -1,70 +0,0 @@ -#!/usr/bin/env python -import soy -import bumpblocks -from time import sleep - -sce = soy.scenes.Scene() -cam = soy.bodies.Camera(sce) -cam.position = (0.0, 0.0, 3.0) -lig = soy.bodies.Light(sce) -lig.position = (-5.0,5.0,5.0) -bks = bumpblocks.blocks(sce) -fps = soy.textures.Print() - -scr = soy.Screen() -win = soy.Window(scr, 'CollideBlocks', background=soy.colors.gray) -pro = soy.widgets.Projector(win, camera=cam) -can = soy.widgets.Canvas(win, texture=fps) - -def wireframeToggle() : - if cam.wireframe : - cam.wireframe = False - else : - cam.wireframe = True - -def fullscreenToggle() : - if scr.fullscreen : - scr.fullscreen = None - else : - scr.fullscreen = win - -def moreLight() : - lig.diffuse = lig.diffuse + 1.0 - print lig.diffuse - -def lessLight() : - lig.diffuse = lig.diffuse - 1.0 - print lig.diffuse - -key = soy.controllers.Keyboard(win) -key['Q'] = soy.actions.Force(bks['Marble'], -100, 0, 0) -key['R'] = soy.actions.Force(bks['Marble'], 0, 100, 0) -key['S'] = soy.actions.Force(bks['Marble'], 100, 0, 0) -key['T'] = soy.actions.Force(bks['Marble'], 0, -100, 0) -key['U'] = soy.actions.Force(bks['Marble'], 0, 0, -100) -key['V'] = soy.actions.Force(bks['Marble'], 0, 0, 100) -key['q'] = soy.actions.Quit() -key[ 1 ] = soy.actions.Quit() # 9 = esc key -key['f'] = fullscreenToggle -key['w'] = wireframeToggle -key['['] = lessLight -key[']'] = moreLight -wcn = soy.controllers.Window(win) -wcn['close'] = soy.actions.Quit() - -if __name__ == '__main__' : - while True: - sleep(.1) - fps.text = '%sfps' % str(int(cam.fps)).zfill(4) - for bk in bks : - p = bks[bk].position - v = bks[bk].velocity - v = [v[0], v[1], v[2]] - if abs(p[0]) > 5 and ((p[0]>0 and v[0]>0) or (p[0]<0 and v[0]< 0)) : - v[0] = v[0]*-1 - if abs(p[1]) > 5 and ((p[1]>0 and v[1]>0) or (p[1]<0 and v[1]< 0)) : - v[1] = v[1]*-1 - if abs(p[2]) > 5 and ((p[2]>0 and v[2]>0) or (p[2]<0 and v[2]< 0)) : - v[2] = v[2]*-1 - bks[bk].velocity = v - Copied: trunk/pysoy/examples/TexBlocks.py (from rev 1188, trunk/pysoy/examples/BumpBlocks.py) =================================================================== --- trunk/pysoy/examples/TexBlocks.py (rev 0) +++ trunk/pysoy/examples/TexBlocks.py 2008-03-20 07:52:22 UTC (rev 1189) @@ -0,0 +1,70 @@ +#!/usr/bin/env python +import soy +import bumpblocks +from time import sleep + +sce = soy.scenes.Scene() +cam = soy.bodies.Camera(sce) +cam.position = (0.0, 0.0, 3.0) +lig = soy.bodies.Light(sce) +lig.position = (-5.0,5.0,5.0) +bks = bumpblocks.blocks(sce) +fps = soy.textures.Print() + +scr = soy.Screen() +win = soy.Window(scr, 'CollideBlocks', background=soy.colors.gray) +pro = soy.widgets.Projector(win, camera=cam) +can = soy.widgets.Canvas(win, texture=fps) + +def wireframeToggle() : + if cam.wireframe : + cam.wireframe = False + else : + cam.wireframe = True + +def fullscreenToggle() : + if scr.fullscreen : + scr.fullscreen = None + else : + scr.fullscreen = win + +def moreLight() : + lig.diffuse = lig.diffuse + 1.0 + print lig.diffuse + +def lessLight() : + lig.diffuse = lig.diffuse - 1.0 + print lig.diffuse + +key = soy.controllers.Keyboard(win) +key['Q'] = soy.actions.Force(bks['Marble'], -100, 0, 0) +key['R'] = soy.actions.Force(bks['Marble'], 0, 100, 0) +key['S'] = soy.actions.Force(bks['Marble'], 100, 0, 0) +key['T'] = soy.actions.Force(bks['Marble'], 0, -100, 0) +key['U'] = soy.actions.Force(bks['Marble'], 0, 0, -100) +key['V'] = soy.actions.Force(bks['Marble'], 0, 0, 100) +key['q'] = soy.actions.Quit() +key[ 1 ] = soy.actions.Quit() # 9 = esc key +key['f'] = fullscreenToggle +key['w'] = wireframeToggle +key['['] = lessLight +key[']'] = moreLight +wcn = soy.controllers.Window(win) +wcn['close'] = soy.actions.Quit() + +if __name__ == '__main__' : + while True: + sleep(.1) + fps.text = '%sfps' % str(int(cam.fps)).zfill(4) + for bk in bks : + p = bks[bk].position + v = bks[bk].velocity + v = [v[0], v[1], v[2]] + if abs(p[0]) > 5 and ((p[0]>0 and v[0]>0) or (p[0]<0 and v[0]< 0)) : + v[0] = v[0]*-1 + if abs(p[1]) > 5 and ((p[1]>0 and v[1]>0) or (p[1]<0 and v[1]< 0)) : + v[1] = v[1]*-1 + if abs(p[2]) > 5 and ((p[2]>0 and v[2]>0) or (p[2]<0 and v[2]< 0)) : + v[2] = v[2]*-1 + bks[bk].velocity = v + _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn