aboutsummaryrefslogtreecommitdiff
path: root/pixelcore
diff options
context:
space:
mode:
authorGravatar eugue <eug.sun@gmail.com>2011-01-24 14:41:38 -0500
committerGravatar eugue <eug.sun@gmail.com>2011-01-24 14:41:38 -0500
commit00e836cfa4e2652d724972585d661143142af002 (patch)
treef612ea43024f13dc8c16f192735676e9976630fc /pixelcore
parentd39f871cf9fcce13c6db315052a4951f692719f9 (diff)
merge with biginstall
Diffstat (limited to 'pixelcore')
-rw-r--r--pixelcore/Pixel.py8
-rw-r--r--pixelcore/PixelEventManager.py2
-rw-r--r--pixelcore/Screen.py10
3 files changed, 10 insertions, 10 deletions
diff --git a/pixelcore/Pixel.py b/pixelcore/Pixel.py
index b9fc07f..7260e56 100644
--- a/pixelcore/Pixel.py
+++ b/pixelcore/Pixel.py
@@ -29,10 +29,10 @@ class Pixel:
#arg
#Add a pixelEvent to the list of active events
- def processInput(self,pixelEvent,zindex, currentTime=None): #consider migrating arg to dict
+ def processInput(self,pixelEvent,zindex, scale=1,currentTime=None): #consider migrating arg to dict
if currentTime == None:
currentTime = timeops.time()
- self.events[currentTime] = (zindex, pixelEvent)
+ self.events[currentTime] = (zindex,scale, pixelEvent)
def clearAllEvents(self):
self.events = {}
@@ -49,10 +49,10 @@ class Pixel:
resultingColor = (0,0,0)
colors = []
for eventTime in self.events: #TODO: right color weighting code
- (zindex,event) = self.events[eventTime]
+ (zindex,scale,event) = self.events[eventTime]
eventResult = event.state(currentTime-eventTime)
if eventResult != None:
- colors.append(eventResult)
+ colors.append(color.multiplyColor(eventResult,scale))
else:
deadEvents.append(eventTime)
diff --git a/pixelcore/PixelEventManager.py b/pixelcore/PixelEventManager.py
new file mode 100644
index 0000000..779a0ce
--- /dev/null
+++ b/pixelcore/PixelEventManager.py
@@ -0,0 +1,2 @@
+class PixelEventManager(object):
+ def init(self)
diff --git a/pixelcore/Screen.py b/pixelcore/Screen.py
index 22cfdb0..cfadee8 100644
--- a/pixelcore/Screen.py
+++ b/pixelcore/Screen.py
@@ -8,6 +8,7 @@ import util.Strings as Strings
import util.TimeOps as timeops
import itertools
import sys
+import pdb
from logger import main_log
#Class representing a collection of Pixels grouped into PixelStrips. Needs a
#PixelMapper, currently set via setMapper by may be migrated into the argDict.
@@ -37,9 +38,7 @@ class Screen:
self.xSortedPixels.sort()
self.xPixelLocs = [p[0] for p in self.xSortedPixels]
- def render(self, surface):
- [lS.render(surface) for lS in self.pixelStrips]
-
+ #For debug only
def allOn(self):
[lS.allOn(-1) for lS in self.pixelStrips]
@@ -74,6 +73,7 @@ class Screen:
maxY = max(y, maxY)
self.size = (0,0, maxX, maxY)
self.sizeValid = True
+ print self.size
return (0, 0, maxX+100, maxY+100) #TODO: cleaner
#private
@@ -89,9 +89,7 @@ class Screen:
#if type(mapper) != type(PixelMapper):
# raise Exception('No default mapper specified.')
pixelWeightList = mapper.mapEvent(responseInfo['Location'], self)
-
PixelEvent.addPixelEventIfMissing(responseInfo)
currentTime = timeops.time()
for (pixel, weight) in pixelWeightList:
- pixel.processInput(responseInfo['PixelEvent'].scale(weight), 0, currentTime) #TODO: z-index
-
+ pixel.processInput(responseInfo['PixelEvent'], 0,weight, currentTime) #TODO: z-index