diff options
author | rcoh <rcoh@mit.edu> | 2010-12-15 00:18:24 -0500 |
---|---|---|
committer | rcoh <rcoh@mit.edu> | 2010-12-15 00:18:24 -0500 |
commit | a89c772cd64c6790906734f7128947e0f453c7e3 (patch) | |
tree | 250e0b0d235e1215fa7b40fcfd24b74028ccf643 /pixelcore | |
parent | 8cecf83f16fcdec5b3ee68cc40c2b360e0f845d0 (diff) |
About halfway done with the Util cleanup. Some stuff left to do with scoping etc.
Diffstat (limited to 'pixelcore')
-rw-r--r-- | pixelcore/Pixel.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pixelcore/Pixel.py b/pixelcore/Pixel.py index ba87dff..f66d0bb 100644 --- a/pixelcore/Pixel.py +++ b/pixelcore/Pixel.py @@ -1,6 +1,7 @@ -import Util +import util.ColorOps as color import pdb from pixelevents.StepEvent import * +import util.TimeOps as clock #Pixel keeps a queue of events (PixelEvent objects) (actually a dictionary #keyed by event time). Every time is state is #requested, it processes all the members of its queue. If a member returns none, @@ -24,7 +25,7 @@ class Pixel: #arg #Add a pixelEvent to the list of active events def processInput(self,pixelEvent,zindex): #consider migrating arg to dict - self.events[Util.time()] = (zindex, pixelEvent) + self.events[clock.time()] = (zindex, pixelEvent) def clearAllEvents(self): self.events = {} #Combines all PixelEvents currently active and computes the current color of @@ -37,13 +38,13 @@ class Pixel: if len(self.events) == 0: return (0,0,0) deadEvents = [] - currentTime = Util.time() + currentTime = clock.time() resultingColor = (0,0,0) for eventTime in self.events: #TODO: right color weighting code (zindex,event) = self.events[eventTime] eventResult = event.state(currentTime-eventTime) if eventResult != None: - resultingColor = Util.combineColors(eventResult, resultingColor) + resultingColor = color.combineColors(eventResult, resultingColor) else: deadEvents.append(eventTime) [self.events.pop(event) for event in deadEvents] |