2020-09-26 22:33:30 +00:00
|
|
|
#!/usr/bin/python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# -*- mode: Python -*-
|
|
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
This is the most basic generator you can imagine: straight up static!
|
|
|
|
v0.1.0
|
|
|
|
|
|
|
|
Use it to test your filters and outputs
|
|
|
|
|
|
|
|
LICENCE : CC
|
|
|
|
|
2020-10-13 20:02:20 +00:00
|
|
|
by cocoa
|
2020-09-26 22:33:30 +00:00
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
from __future__ import print_function
|
|
|
|
import time
|
|
|
|
import argparse
|
|
|
|
import sys
|
|
|
|
name="generator::dummy"
|
|
|
|
|
|
|
|
|
|
|
|
def debug(*args, **kwargs):
|
|
|
|
if( verbose == False ):
|
|
|
|
return
|
|
|
|
print(*args, file=sys.stderr, **kwargs)
|
|
|
|
|
2020-10-13 20:02:20 +00:00
|
|
|
argsparser = argparse.ArgumentParser(description="dummy generator")
|
2020-09-26 22:33:30 +00:00
|
|
|
argsparser.add_argument("-f","--fps",help="Frame Per Second",default=30,type=int)
|
2020-10-13 20:02:20 +00:00
|
|
|
argsparser.add_argument("-s","--speed",help="point per frame progress",default=3,type=int)
|
2020-09-26 22:33:30 +00:00
|
|
|
argsparser.add_argument("-v","--verbose",action="store_true",help="Verbose output")
|
2020-10-13 20:02:20 +00:00
|
|
|
args = argsparser.parse_args()
|
2020-09-26 22:33:30 +00:00
|
|
|
|
|
|
|
fps=args.fps
|
|
|
|
verbose=args.verbose
|
|
|
|
optimal_looptime = 1 / fps
|
|
|
|
debug(name+" optimal looptime "+str(optimal_looptime))
|
2020-10-13 20:02:20 +00:00
|
|
|
color = 16777215
|
2020-10-09 16:30:28 +00:00
|
|
|
square = [[100.0, 100.0, color], [100.0, 500.0, color], [500.0, 500.0, color], [500.0, 100.0, color], [100.0, 100.0, color]]
|
|
|
|
line =[]
|
|
|
|
for i in range(00,800,int(800/120)):
|
|
|
|
line.append([i, 400, color])
|
|
|
|
square = [[100.0, 100.0, color], [100.0, 500.0, color], [500.0, 500.0, color], [500.0, 100.0, color], [100.0, 100.0, color]]
|
|
|
|
mire = [
|
|
|
|
[600,600,0],
|
|
|
|
[600,600,color],
|
|
|
|
[700,600,color],
|
|
|
|
[700,700,color],
|
|
|
|
[600,700,color],
|
|
|
|
[600,600,color],
|
|
|
|
[100,100,0],
|
|
|
|
[100,100,color],
|
|
|
|
[200,100,color],
|
|
|
|
[200,200,color],
|
|
|
|
[100,200,color],
|
|
|
|
[100,100,color],
|
|
|
|
[0,0,0],
|
|
|
|
[0,0,color],
|
|
|
|
[800,0,color],
|
|
|
|
[800,800,color],
|
|
|
|
[0,800,color],
|
|
|
|
[0,0,color],
|
|
|
|
[350,400,0],
|
|
|
|
[350,400,color],
|
|
|
|
[450,400,color],
|
|
|
|
[400,350,0],
|
|
|
|
[400,350,color],
|
|
|
|
[400,450,color],
|
|
|
|
]
|
|
|
|
|
2020-10-13 20:02:20 +00:00
|
|
|
shape = mire
|
2020-10-09 16:30:28 +00:00
|
|
|
|
2020-09-26 22:33:30 +00:00
|
|
|
|
|
|
|
while True:
|
|
|
|
start = time.time()
|
2020-10-09 16:30:28 +00:00
|
|
|
print(shape, flush=True);
|
2020-09-26 22:33:30 +00:00
|
|
|
looptime = time.time() - start
|
|
|
|
if( looptime < optimal_looptime ):
|
|
|
|
time.sleep( optimal_looptime - looptime)
|
|
|
|
debug(name+" micro sleep:"+str( optimal_looptime - looptime))
|
2020-10-13 20:02:20 +00:00
|
|
|
|
2020-09-26 22:33:30 +00:00
|
|
|
|