shithub: binrc

ref: b82b52776f6c6cb34a2bca222e3c92ac918ae517
dir: /olenda/

View raw version
#!/bin/rc

face = '/lib/face/48x48x4/g/glenda.1'
bunny = /lib/bunny.bit
img = $bunny
refpath = /mnt/reform/kbdoled

argv0 = $0
fn usage {
	echo >[1=2] 'usage:' $argv0 '[-bf] [-r reform/] [-i img.bit]'
	exit 'usage'
}

while(~ $1 -*)
	switch($1){
	case -f
		$img = $face
		shift
	case -b
		$img = $bunny
		shift
	case -r
		shift
		$refpath = $1
		shift

	case -i
		shift
		$img = $1
		shift

	case -*
		# Unknown flags trigger usage text
		usage

}

# x0 = inc x0 i 
fn inc {
	echo $1^'+'^$2 | bc 
}

# 126 x 32 oled
while(){
	i = 10
	x0 = 20
	y0 = 0
	x1 = 146
	y1 = 32

	for(nothing in `{seq 14}){
		crop -r $x0 $y0 $x1 $y1 < $img | iconv -u > $refpath
		#x0 = `{inc $x0 $i}
		y0 = `{inc $y0 $i}
		#x1 = `{inc $x1 $i}
		y1 = `{inc $y1 $i}
		sleep 0.1
	}
}