def dac_thread(): global OBJ ps = PointStream() ps.objects.append(OBJ) ps.showBlankingPath = False ps.showTrackingPath = False ps.blankingSamplePts = 10 ps.trackingSamplePts = 10 while True: try: d = dac.DAC(dac.find_first_dac()) d.play_stream(ps) except KeyboardInterrupt: sys.exit() except Exception as e: import sys, traceback print '\n---------------------' print 'Exception: %s' % e print '- - - - - - - - - - -' traceback.print_tb(sys.exc_info()[2]) print "\n"
def dac_process(): global ps ps = PointStream() #ps.showBlanking = True #ps.showTracking = True ps.blankingSamplePts = 7 ps.trackingSamplePts = 7 thread.start_new_thread(dac_thread, ()) time.sleep(0.50) thread.start_new_thread(copy_struct_thread, ()) while True: time.sleep(100000)
def dac_thread(): global SINEW global WAVE_PERIODS ps = PointStream() #ps.showTracking = True #ps.showBlanking = True ps.trackingSamplePts = 50 ps.blankingSamplePts = 50 SINEW = SineWave(0, 0, COLOR_R/LASER_POWER_DENOM, COLOR_G/LASER_POWER_DENOM, COLOR_B/LASER_POWER_DENOM) SINEW.numPeriods = WAVE_PERIODS SINEW.width = WAVE_WIDTH SINEW.sineAmp = WAVE_AMPLITUDE_MAGNITUDE SINEW.x = ORIGIN_X SINEW.y = ORIGIN_Y #SQUARE.x = SQUARE_X #SQUARE.y = SQUARE_Y ps.objects.append(SINEW) while True: try: d = dac.DAC(dac.find_first_dac()) d.play_stream(ps) except KeyboardInterrupt: sys.exit() except Exception as e: import sys, traceback print '\n---------------------' print 'Exception: %s' % e print '- - - - - - - - - - -' traceback.print_tb(sys.exc_info()[2]) print "\n" pass
def main(): global objs global ps # XXX: Insecure!! modname = 'disapprove' if len(sys.argv) > 1: modname = sys.argv[1] exec "from objs.%s import OBJECTS" % modname exec "from objs.%s import MULT_X, MULT_Y" % modname exec "from objs.%s import ADD_X, ADD_Y" % modname for i in range(len(OBJECTS)): #obj in OBJECTS: coords = OBJECTS[i] # Normalize/fix coordinate system for j in range(len(coords)): c = coords[j] x = math.floor(float(c['x']) * MULT_X) + ADD_X y = math.floor(float(c['y']) * MULT_Y) + ADD_Y coords[j] = { 'x': x, 'y': y } OBJECTS[i] = coords objs.append(SvgPath(coords=coords)) ps = PointStream() #ps.showBlanking = True #ps.showTracking = True ps.blankingSamplePts = 7 ps.trackingSamplePts = 7 thread.start_new_thread(dac_thread, ()) time.sleep(1.0) #thread.start_new_thread(spin_thread, ()) while True: time.sleep(100000)
def main(): global objs global ps # XXX: Insecure!! modname = 'disapprove' if len(sys.argv) > 1: modname = sys.argv[1] exec "from objs.%s import OBJECTS" % modname exec "from objs.%s import MULT_X, MULT_Y" % modname exec "from objs.%s import ADD_X, ADD_Y" % modname for i in range(len(OBJECTS)): #obj in OBJECTS: coords = OBJECTS[i] # Normalize/fix coordinate system for j in range(len(coords)): c = coords[j] x = math.floor(float(c['x']) * MULT_X) + ADD_X y = math.floor(float(c['y']) * MULT_Y) + ADD_Y coords[j] = {'x': x, 'y': y}; OBJECTS[i] = coords objs.append(SvgPath(coords=coords)) ps = PointStream() #ps.showBlanking = True #ps.showTracking = True ps.blankingSamplePts = 7 ps.trackingSamplePts = 7 thread.start_new_thread(dac_thread, ()) time.sleep(1.0) #thread.start_new_thread(spin_thread, ()) while True: time.sleep(100000)
def dac_thread(): global l ps = PointStream() #ps.showTracking = True #ps.showBlanking = True ps.trackingSamplePts = 5 ps.blankingSamplePts = 50 l = Tunnel(0, 0, COLOR_R/LASER_POWER_DENOM, COLOR_G/LASER_POWER_DENOM, COLOR_B/LASER_POWER_DENOM) l.x = ORIGIN_X l.y = ORIGIN_Y #SQUARE.x = SQUARE_X #SQUARE.y = SQUARE_Y ps.objects.append(l) while True: try: d = dac.DAC(dac.find_first_dac()) d.play_stream(ps) except KeyboardInterrupt: sys.exit() except Exception as e: import sys, traceback print '\n---------------------' print 'Exception: %s' % e print '- - - - - - - - - - -' traceback.print_tb(sys.exc_info()[2]) print "\n"
def produce(self): r, g, b = (0, 0, 0) r = 0 if not self.r else int(self.r / LASER_POWER_DENOM) g = 0 if not self.g or LASER_POWER_DENOM > 4 else self.g b = 0 if not self.b else int(self.b / LASER_POWER_DENOM) p = (self.x, self.y, r, g, b) for i in range(POINT_NUM_SAMPLE_PTS): yield p self.drawn = True PS = PointStream() PS.trackingSamplePts = TRACKING_SAMPLE_PTS PS.blankingSamplePts = BLANKING_SAMPLE_PTS def dac_thread(): global PS while True: try: d = dac.DAC(dac.find_first_dac()) d.play_stream(PS) except KeyboardInterrupt: sys.exit() except Exception as e: import sys, traceback
def main(): global SHOW global ps def next_anim_thread(): global SHOW while True: SHOW.next() time.sleep(5.0) ps = PointStream() ps.scale = 0.0000001 #ps.showBlanking = True #ps.showTracking = True ps.blankingSamplePts = 12 ps.trackingSamplePts = 12 ps.scale = 0.6 #ps.rotate = math.pi / 4 SHOW = Show() SHOW.stream = ps mike = SvgAnim('michael', anim = { 'rotate': True, 'rotateRate': 0.001, 'rotateMin': -0.501, 'rotateMax': 0.501, 'scale': True, 'scaleRate': 0.0009, 'scaleMin': 0.5, 'scaleMax': 1.2, } ) #s = snoo.objects[0] #s.trackingSamplePts = 5 #s.blankingSamplePts = 50 #for o in snoo.objects: # o.scale = 2.0 # #o.showBlanking = True #snoo.showBlanking = True #snoo.scale = 2.0 #SHOW.animations.append(mike) #SHOW.animations.append(AwesomeAnimation()) #SHOW.animations.append(BatAnimation()) #SHOW.animations.append(BouncingBall(numBalls=4)) #SHOW.animations.append(GhostAnimation()) #SHOW.animations.append(GhostAnimation()) #SHOW.animations.append(BatAnimation()) octo = SvgAnim('octocat', anim = { 'rotate': True, 'rotateRate': 0.001, 'rotateMin': -0.501, 'rotateMax': 0.501, 'scale': True, 'scaleRate': 0.0009, 'scaleMin': 0.5, 'scaleMax': 1.2, } ) default = 'snoo' name = get_obj_filename() if not name: name = default obj = SvgAnim(name, anim = { #'rotate': True, #'rotateRate': 0.0005, #'rotateMin': -0.501, #'rotateMax': 0.501, #'scale': True, #'scaleRate': 0.0001, #'scaleMin': 0.1, #'scaleMax': 0.4, } ) SHOW.animations.append(obj) #SHOW.animations.append(GmlAnim('gml/happy2.gml')) #SHOW.animations.append(GmlAnim('gml/birthday2.gml')) #SHOW.animations.append(GmlAnim('gml/i_heart_js.gml')) #SHOW.animations.append(octo) """ SHOW.animations.append( GmlAnim('gml/doritoslocos.gml') ) SHOW.animations.append(ArrowAnim()) """ SHOW.next() SHOW.prev() SHOW.start_dac_thread() time.sleep(1.0) thread.start_new_thread(next_anim_thread, ()) while True: time.sleep(100000)
from entities.ball import * from entities.paddle import * ############################ # OBJECT AND GAME SETUP ############################ surf = Surface(X_MAX, X_MIN, Y_MAX, Y_MIN) ps = PointStream() ps.setCenter(surf.absCenter['x'], surf.absCenter['y']) ps.flipX = FLIP_X ps.flipY = FLIP_Y ps.showBlanking = False ps.showTracking = False ps.trackingSamplePts = 15 ps.blankingSamplePts = 15 ballRadius = (math.sqrt(surf.getArea()) / 20) * BALL_RADIUS_MULT ball = Ball() ball.setRadius(ballRadius) ball.setPos(0, 0) ball.setColor(0, CMAX, 0) paddles = [] for i in range(2): paddle = Paddle() paddles.append(paddle) w = (surf.width * 1/64.0) * PADDLE_WIDTH_MULT # TODO: sqrt h = (surf.height * 1/3.0) * PADDLE_HEIGHT_MULT # TODO: sqrt paddle.setSize(w, h)