ref: 5cf932b7a032a685aca7512336a70b608e605c9e
dir: /atlasc/
#!/bin/rc rfork e atlas -o /tmp/atlas.off $* > /tmp/atlas echo 'static u8int atlas_texture[] = {' hx /tmp/atlas | awk -F' ' '{print $2, $3}' | sed 's/ *$/,/g;s/^/ 0x/g;s/ /, 0x/g' echo '};' echo echo 'static struct {' echo ' int x, y, w, h;' echo '}atlas[] = {' cat /tmp/atlas.off | while(a=`{read}) { echo ' ['`{basename $a(1) | sed 's/\..*//g' | tr '[a-z]' '[A-Z]'}^'] = {'$a(2)^, $a(3)^, $a(4)^, $a(5)^'},' } echo '};' echo 'enum {' >[1=2] cat /tmp/atlas.off | while(a=`{read}) { echo ' '`{basename $a(1) | sed 's/\..*//g' | tr '[a-z]' '[A-Z]'}^',' } >[1=2] echo '};' >[1=2] rm -f /tmp/atlas.off /tmp/atlas