From f6dd5ab92949843d2fb163e2d84f19e824a291dc Mon Sep 17 00:00:00 2001 From: rcoh Date: Sun, 13 Feb 2011 03:57:56 -0500 Subject: Added OSC (phone controlled) behavior to the C5 Sign --- config/C5Sign.xml | 44 ++++++++++++++++++++++++++++++++++++-------- inputs/PygameInput.py | 4 ++++ renderers/PygameRenderer.py | 7 ++++++- 3 files changed, 46 insertions(+), 9 deletions(-) diff --git a/config/C5Sign.xml b/config/C5Sign.xml index 65a45bc..8c2871e 100644 --- a/config/C5Sign.xml +++ b/config/C5Sign.xml @@ -22,7 +22,7 @@ gaussmap 30 0.1 - 10 + 7 1 @@ -44,6 +44,14 @@ True + + inputs.OSCInput + + osc + 1234 + 10 + + inputs.PygameInput @@ -73,6 +81,12 @@ + + + touchosc + + behaviors.TouchOSC + behaviors/RandomColor.xml @@ -82,6 +96,21 @@ + + behaviors.BehaviorChain + + OSCTouchChase + + osc + + + touchosc + decay + + gaussmap + True + + behaviors/PixelDecay.xml @@ -98,8 +127,8 @@ behaviors.XYMove xymove - 5 - 2 + 1 + 1 @@ -108,7 +137,7 @@ xbounce {val}*-1 XStep - {x}<0 or {x}>200 + {x}<2 or {x}>48 @@ -117,7 +146,7 @@ ybounce {val}*-1 YStep - {y}<0 or {y}>100 + {y}<2 or {y}>24 @@ -126,7 +155,7 @@ movebounce xymove - colorshift + ybounce xbounce @@ -175,12 +204,11 @@ colorchange mover - square decay {'mover':'movebounce'} True - + gaussmap diff --git a/inputs/PygameInput.py b/inputs/PygameInput.py index 480630c..8de55f9 100644 --- a/inputs/PygameInput.py +++ b/inputs/PygameInput.py @@ -15,6 +15,10 @@ class PygameInput(Input): NB: If follow mouse is enabled, PygameInput will not return mouse and keypresses. You can, however, instantiate other PygameInputs in the XML that will capture mouse and keypresses.""" def sensingLoop(self): + if 'Scale' in self: + scale = self['Scale'] + else: + scale = 1 if self['FollowMouse']: self.respond({Strings.LOCATION: pygame.mouse.get_pos()}) return diff --git a/renderers/PygameRenderer.py b/renderers/PygameRenderer.py index bc50360..01e2615 100644 --- a/renderers/PygameRenderer.py +++ b/renderers/PygameRenderer.py @@ -18,8 +18,13 @@ class PygameRenderer(Renderer): def render(self, lightSystem, currentTime=timeops.time()): self.background.fill(Color(0,0,0)) #print 'drawing color:',light.color + if 'Scale' in self: + scale = self['Scale'] + else: + scale = 1 for light in lightSystem: - pygame.draw.circle(self.background, light.state(currentTime), light.location, \ + scaledLoc = [l*scale for l in light.location] + pygame.draw.circle(self.background, light.state(currentTime), scaledLoc, \ light.radius) self.screen.blit(self.background, (0,0)) -- cgit v1.2.3