aboutsummaryrefslogtreecommitdiff
path: root/renderers
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2011-01-27 16:50:59 -0500
committerGravatar rcoh <rcoh@mit.edu>2011-01-27 16:50:59 -0500
commit5fb3ea060025241105dc8e9a174513c112f9a133 (patch)
treee98b1b3eab0b05b0e518b08cbab086d224fd9250 /renderers
parent5d29906fff79bc6e4ba83be7028e1380a0014d21 (diff)
A metric $#%$-ton of changes. Added doc-strings to EVERYTHING. Phew. Fixed a massive bug that
increases performance in by up to a factor of 60. A bunch of new behaviors for the class.
Diffstat (limited to 'renderers')
-rw-r--r--renderers/IndoorRenderer.py6
-rw-r--r--renderers/PygameRenderer.py7
2 files changed, 8 insertions, 5 deletions
diff --git a/renderers/IndoorRenderer.py b/renderers/IndoorRenderer.py
index 76ec172..531a732 100644
--- a/renderers/IndoorRenderer.py
+++ b/renderers/IndoorRenderer.py
@@ -4,8 +4,9 @@ import util.NetworkOps as network
import util.TimeOps as timeops
import socket,pdb
sock_port = 6038
-#Renderer for a Specific Light System.
class IndoorRenderer(Renderer):
+ """IndoorRenderer is a renderer for a specific Light System"""
+
def initRenderer(self):
self.stripLocations = {} #Dict that stores info necessary to render to
#strips
@@ -20,6 +21,7 @@ class IndoorRenderer(Renderer):
for stripId in stripsInPowerSupply:
self.stripLocations[stripId] = (ip, \
stripsInPowerSupply[stripId])
+
def render(self, lightSystem, currentTime=timeops.time()):
#try:
for pixelStrip in lightSystem.pixelStrips:
@@ -30,6 +32,4 @@ class IndoorRenderer(Renderer):
self.sockets[ip] = network.getConnectedSocket(ip,sock_port)
packet = composer.composePixelStripPacket(pixelStrip, port, currentTime)
self.sockets[ip].send(packet, 0x00)
- #except Exception as inst:
- # print inst
diff --git a/renderers/PygameRenderer.py b/renderers/PygameRenderer.py
index 9582a03..bc50360 100644
--- a/renderers/PygameRenderer.py
+++ b/renderers/PygameRenderer.py
@@ -4,16 +4,19 @@ import pygame
from pygame.locals import *
import pdb
class PygameRenderer(Renderer):
+ """PygameRenderer is a renderer which renders the LightSystem to a pygame display"""
+
def initRenderer(self):
pygame.init()
self.screen = pygame.display.set_mode((1300,500))
self.background = pygame.Surface(self.screen.get_size())
self.background = self.background.convert()
- self.background.fill(Color('Black'))
+ self.background.fill(Color(0,0,0))
self.stopwatch = timeops.Stopwatch()
self.stopwatch.start()
+
def render(self, lightSystem, currentTime=timeops.time()):
- self.background.fill(Color('Black'))
+ self.background.fill(Color(0,0,0))
#print 'drawing color:',light.color
for light in lightSystem:
pygame.draw.circle(self.background, light.state(currentTime), light.location, \