From 9c9babfa7032b443138c4b457aabaf79fad385b3 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Fri, 26 Nov 2010 00:07:14 -0500 Subject: Add PixelMapper functionality to abstract away from mapping locations->Pixels. --- pixelcore/Screen.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pixelcore/Screen.py') 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 -- cgit v1.2.3