Browse files

added threading to pong

  • Loading branch information...
1 parent 4ccdcf6 commit 360d351c4968d92e48c29e32989f6085e0fa6ae8 @mostley mostley committed Oct 8, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 site/modules/pong.py
View
15 site/modules/pong.py
@@ -1,3 +1,4 @@
+from threading import Thread
from ledlib.colors import *
from ledlib.remote import Remote
from ledlib.vector import *
@@ -10,12 +11,26 @@ def __init__(self):
self.leftPaddle = Vector(0,4)
self.rightPaddle = Vector(11,4)
self.ball = Vector(6,4)
+ self.thread = None
def init(self):
self.remote = Remote()
self.grid = self.remote.createGridBuffer(BLACK)
self.remote.sendGrid(self.grid)
+ try:
+ self.thread = Thread(target=self.update, args=self)
+ self.thread.start()
+ except Exception, errtxt:
+ print errtxt
+
+ def deinit(self):
+ self.thread.stop()
+
+ def update(self):
+ pass
+
+
def execute(self, data):
result = False

0 comments on commit 360d351

Please sign in to comment.