aboutsummaryrefslogtreecommitdiff
path: root/pixelcore/Screen.py
diff options
context:
space:
mode:
authorGravatar Russell Cohen <rcoh@mit.edu>2010-11-26 00:07:14 -0500
committerGravatar Russell Cohen <rcoh@mit.edu>2010-11-26 00:07:14 -0500
commit9c9babfa7032b443138c4b457aabaf79fad385b3 (patch)
treef9bf3e8b51423bf6769d2c655ffa15d81a42333f /pixelcore/Screen.py
parent1754a1f4511ef52f0a093dd0f9915196bd4261e7 (diff)
Add PixelMapper functionality to abstract away from mapping locations->Pixels.
Diffstat (limited to 'pixelcore/Screen.py')
-rw-r--r--pixelcore/Screen.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/pixelcore/Screen.py b/pixelcore/Screen.py
index 9806daa..561dc21 100644
--- a/pixelcore/Screen.py
+++ b/pixelcore/Screen.py
@@ -9,6 +9,8 @@ class Screen:
self.pixelStrips.append(lS)
def render(self, surface):
[lS.render(surface) for lS in self.pixelStrips]
+ def setMapper(self, mapper):
+ self.mapper = mapper
def allOn(self):
[lS.allOn(-1) for lS in self.pixelStrips]
def __iter__(self): #the iterator of all our pixel strips chained togther
@@ -27,5 +29,9 @@ class Screen:
#private
def processResponse(self, responseInfo): #we need to make a new dict for
#each to prevent interference
- [strip.respond(dict(responseInfo)) for strip in self.pixelStrips]
+ #[strip.respond(dict(responseInfo)) for strip in self.pixelStrips]
+ pixelWeightList = self.mapper.mapEvent(responseInfo['Location'], self)
+ Util.addPixelEventIfMissing(responseInfo)
+ for (pixel, weight) in pixelWeightList: #TODO: weighting
+ pixel.processInput(responseInfo['PixelEvent'], 0) #TODO: z-index