def handle_collisions_paddles(self, display): c1 = display.safe_get(self.x + self.dx * self.dt, self.y) if c1 != Color.black() and c1 != Color.white(): self.dx *= -1 c2 = display.safe_get(self.x, self.y + self.dy * self.dt) if c2 != Color.black() and c2 != Color.white(): self.dy *= -1
def __init__(self, bor): self.set_defaults() self.bor = bor self.palette = [Color.white(), Color.red(), Color.green(), Color.blue(), Color(255,255,0), Color(0,255,255), Color(255,0,255), Color(255,121,0), Color.black()] self.current = Color.blue()
def __init__(self, bor): # self.currnet_idx = 16 self.currnet_idx = 19 texte = text.Text(bor) texte.set_text(10, 1, "XD XD XD XD") self.effects = [ texte, # 0 pixels.Pixels(bor), # 1 rainbow.Rainbow(bor), # 2 sinrainbow2.SinRainbow2(bor), # 3 sinrainbow.SinRainbow(bor), # 4 # tetris.Tetris(10, 10), metaballs.Metaballs(bor), # 5 disco.Disco(), # 6 pulsingcolor.PulsingColor(Color.blue()), # 7 xdcolor.XDColor(Color.red()), # 8 xdcolor.XDColor(Color.green()), # 9 xdcolor.XDColor(Color.blue()), # 10 solidcolor.SolidColor(Color.black()), # 11 droplet.Droplet(bor), # 12 paint.Paint(bor), # 13 tennis.Tennis(bor), # 14 rays.Rays(bor), # 15 plasma.Plasma(bor), # 16 #GifPlayer('/home/pi/xD-Table-Py/effects/gifplayer/gifs/fireplace_smol.gif'), # 17 GifPlayer( '/home/pi/xD-Table-Py/effects/gifplayer/gifs/fireplace_doniel.gif' ), # 17 rainbow_slow.RainbowSlow(bor), # 18 kibana.Heatmap(), # 19 ]
import sys sys.path.append('../utils') from driver import Driver from display import Display, Color dr = Driver("192.168.1.214", 6454) display = Display(10, 10) pallette = [Color.hsv(i / 22 + 0.5) for i in range(10)] def draw_bar(x, height): for i in range(height + 1): display.set(x, i, pallette[i]) with open('cava.output') as f: while True: l = f.readline().strip().split(';')[10:-1] l = l[::-1] l = [int(i) for i in l] display.fill(Color.black()) for i, c in enumerate(l): draw_bar(i, c) dr.set_matrix(display.serialize())