aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar dxiao <dxiao@mit.edu>2011-02-13 04:08:05 -0500
committerGravatar dxiao <dxiao@mit.edu>2011-02-13 04:08:05 -0500
commitfc141723d2a926d1a07e47eb3a9be6618986bf50 (patch)
treef0de17e59d2acc29df09d3a7df57abc1e87e04e6
parent5de7f02a2b7bd8e79847311da834f025421726c6 (diff)
parentf6dd5ab92949843d2fb163e2d84f19e824a291dc (diff)
Merge branch 'conner5' of github.com:dxiao/SmootLight into conner5
Conflicts: config/C5Sign.xml
-rw-r--r--config/C5Sign.xml41
-rw-r--r--inputs/PygameInput.py4
-rw-r--r--renderers/PygameRenderer.py7
3 files changed, 45 insertions, 7 deletions
diff --git a/config/C5Sign.xml b/config/C5Sign.xml
index 6160b11..f193c39 100644
--- a/config/C5Sign.xml
+++ b/config/C5Sign.xml
@@ -22,7 +22,7 @@
<Id>gaussmap</Id>
<CutoffDist>30</CutoffDist>
<MinWeight>0.1</MinWeight>
- <Width>10</Width>
+ <Width>7</Width>
<Height>1</Height>
</Args>
</PixelMapper>
@@ -45,6 +45,14 @@
</Args>
</InputElement>
<InputElement>
+ <Class>inputs.OSCInput</Class>
+ <Args>
+ <Id>osc</Id>
+ <Port>1234</Port>
+ <RefreshInterval>10</RefreshInterval>
+ </Args>
+ </InputElement>
+ <InputElement>
<Class>inputs.PygameInput</Class>
<Args>
<Id>pygamekey</Id>
@@ -73,6 +81,12 @@
</InputElement>
</InputConfiguration>
<BehaviorConfiguration>
+ <Behavior>
+ <Args>
+ <Id>touchosc</Id>
+ </Args>
+ <Class>behaviors.TouchOSC</Class>
+ </Behavior>
<Behavior Id="colorchange">
<InheritsFrom>behaviors/RandomColor.xml</InheritsFrom>
<Args>
@@ -82,6 +96,21 @@
</ColorList>
</Args>
</Behavior>
+ <Behavior>
+ <Class>behaviors.BehaviorChain</Class>
+ <Args>
+ <Id>OSCTouchChase</Id>
+ <Inputs>
+ <Id>osc</Id>
+ </Inputs>
+ <ChainedBehaviors>
+ <Id>touchosc</Id>
+ <Id>decay</Id>
+ </ChainedBehaviors>
+ <Mapper>gaussmap</Mapper>
+ <RenderToScreen>True</RenderToScreen>
+ </Args>
+ </Behavior>
<Behavior Id="decay">
<InheritsFrom>behaviors/PixelDecay.xml</InheritsFrom>
</Behavior>
@@ -98,8 +127,8 @@
<Class>behaviors.XYMove</Class>
<Args>
<Id>xymove</Id>
- <XStep>5</XStep>
- <YStep>2</YStep>
+ <XStep>1</XStep>
+ <YStep>1</YStep>
</Args>
</Behavior>
<Behavior>
@@ -108,7 +137,7 @@
<Id>xbounce</Id>
<Action>{val}*-1</Action>
<ParamName>XStep</ParamName>
- <LocationRestriction>{x}&lt;0 or {x}&gt;200</LocationRestriction>
+ <LocationRestriction>{x}&lt;2 or {x}&gt;48</LocationRestriction>
</Args>
</Behavior>
<Behavior>
@@ -117,7 +146,7 @@
<Id>ybounce</Id>
<Action>{val}*-1</Action>
<ParamName>YStep</ParamName>
- <LocationRestriction>{y}&lt;0 or {y}&gt;100</LocationRestriction>
+ <LocationRestriction>{y}&lt;2 or {y}&gt;24</LocationRestriction>
</Args>
</Behavior>
<Behavior>
@@ -126,7 +155,7 @@
<Id>movebounce</Id>
<ChainedBehaviors>
<Id>xymove</Id>
- <Id>colorshift</Id>
+ <!--Id>colorshift</Id-->
<Id>ybounce</Id>
<Id>xbounce</Id>
</ChainedBehaviors>
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))