Esempio n. 1
0
def dac_thread():
    global OBJ

    ps = PointStream()

    OBJ = Line()
    ps.objects.append(OBJ)

    ps.showBlankingPath = True
    ps.showTrackingPath = True

    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"
Esempio n. 2
0
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"
Esempio n. 3
0
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)
Esempio n. 4
0
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)
Esempio n. 5
0
def dac_thread():
	global SQUARE
	global SQUARE_X, SQUARE_Y
	global SQUARE_R, SQUARE_G, SQUARE_B
	global SQUARE_SIZE_MIN

	ps = PointStream()

	SQUARE = Square(0, 0, SQUARE_R, SQUARE_G, SQUARE_B,
			radius = SQUARE_SIZE_MIN)

	ps.objects.append(SQUARE)

	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"
Esempio n. 6
0
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
Esempio n. 7
0
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)
Esempio n. 8
0
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)
Esempio n. 9
0
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"
Esempio n. 10
0
def main():
    global obj
    global ps

    cwd = os.path.dirname(__file__)
    fname = "gml/hello.gml"
    if len(sys.argv) > 1:
        fname = sys.argv[1]

    fname = os.path.join(cwd, fname)

    obj = Graffiti(filename=fname)
    ps = PointStream()

    thread.start_new_thread(dac_thread, ())
    time.sleep(1.0)
    #thread.start_new_thread(spin_thread, ())

    while True:
        time.sleep(100000)
Esempio n. 11
0
	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:
Esempio n. 12
0
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)
Esempio n. 13
0
VEL_MIN = 150 # Typically 150
VEL_MAX = 400 # Typically 400
ACCEL = 0.15 # Typically 0.15

EMBER_NUM_SAMPLE_PTS = 15
TRACKING_SAMPLE_PTS = 10
BLANKING_SAMPLE_PTS = 15

EMBERS_MIN = 4
EMBERS_MAX = 10

"""
GLOBALS
"""

PS = PointStream()
#PS.scale = 0.12
PS.translateX = 0
PS.translateY = 0
PS.trackingSamplePts = TRACKING_SAMPLE_PTS
PS.blankingSamplePts = BLANKING_SAMPLE_PTS

fireworks = []

class COLORS(object):
	WHITE = 'white'
	WHITE_GREEN = 'white/green'
	WHITE_BLUE = 'white/blue'
	GREEN_BLUE= 'green/blue'
	GREEN = 'green'
	BLUE = 'blue'
Esempio n. 14
0
from surface import *

# PONG ENTITIES
from entities.box import *
from entities.wall import *
from entities.quad import *
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 = []