syndilights/clients/cellular.py

40 lines
850 B
Python
Raw Permalink Normal View History

2013-09-19 22:29:57 +02:00
# Client program "cellular"
2013-09-22 00:26:32 +02:00
import sys, time
2013-09-19 22:29:57 +02:00
from math import *
from random import randint
2013-09-30 23:36:19 +02:00
from s2llib import *
2013-09-19 22:29:57 +02:00
# setup window area, channels and segments
2013-09-30 23:36:19 +02:00
seg_windows = 12
2013-09-19 22:29:57 +02:00
segments = 8 # number of segments in a window (7 + period/dot/point)
width = 12
height = 8
zlevel = 20
2013-09-19 22:29:57 +02:00
segchannels = 4 # RGBA
cell = syndelights_canvas("s2l\n<8<18 ", zlevel, width, height, seg_windows, "127.0.0.1", 5001, "127.0.0.1", 4321, 2)
2013-09-19 22:29:57 +02:00
2013-09-30 23:36:19 +02:00
cell.connect()
2013-09-30 23:36:19 +02:00
# reset/initialize map
cell.reset_windows(0, 0, 0, 0, 0)
cell.reset_segment_windows(0, 255, 255, 255, 255)
2013-09-19 22:29:57 +02:00
# main loop
while True:
# set start seed
# get random location
rx = randint(0, width - 1)
ry = randint(0, height - 1)
2013-09-22 00:26:32 +02:00
2013-09-30 23:36:19 +02:00
cell.setwin_xy_srgba_array(rx, ry, [0, randint(0,127), randint(0, 127), randint(0, 127), 255])
cell.draw()
time.sleep(0.1)
# end of main animation loop
2013-09-19 22:29:57 +02:00
2013-09-30 23:36:19 +02:00
cell.disconnect()