blit-menu

Posted by: fvgestel

blit-menu - 28/09/2000 18:58

Hi all,

I have just finished my empeg-menu,
This application will let you start up all kinds of commands fromthe empeg front-buttons.
It will read an imagefile with ascii-characters and a configfile.
The configfile looks like this:
Start inetd:/sbin/inetd
IP home:/sbin/ifconfig eth0 192.168.12.2
IP work:/sbin/ifconfig eth0 130.144.236.58
turn on swap:/sbin/swapon /usr/local/root/swapfile
turn off swap:/sbin/swapoff /usr/local/root/swapfile
mnt ro /:/bin/mount -n -o remount,ro /
mnt rw /:/bin/mount -n -o remount,rw /
mnt ro /drive0:/bin/mount -n -o remount,ro /dev/hda4 /drive0
mnt rw /drive0:/bin/mount -n -o remount,rw /dev/hda4 /drive0
shell on serial:echo "Press q to start shell"; if /usr/local/sbin/getkey q; then /bin/bash; fi
Xterm home:/usr/bin/X11/xterm -display 192.168.11.1:0
Xterm work:/usr/bin/X11/xterm -display 130.144.236.12:0
reboot:/sbin/reboot -f

the empeg will show the titles on the display and you can navigate using left and right. When you push the down-button the associated action will be printed on stdout and the application will exit.
This can be used in your init script like this.
(I've supplied mine)

#!/bin/bash
#
ASCII_IMG=/usr/local/images/ascii.raw
MENU_CFG=/usr/local/menu/menu.cfg
mount -n -o remount,ro /
/bin/mount -n -o nocheck,rw /proc
/bin/mount -n -o nocheck,ro /dev/hda4 /drive0
while :
do
/empeg/bin/player
CMD="1"
while [ -n "$CMD" ]
do
CMD=`blitmenu $ASCII_IMG $MENU_CFG`
eval $CMD
done
echo "Press q to terminate to a shell"
/usr/local/sbin/getkey q && /bin/bash
done


getkey is a program which waits for 5 seconds for a specific key to be pressed. I got it from redhat and modified it, because it didn't work on my serial console.(Probably the same reason that CTRL-C doesn't work).

I will release the source next week; I've got to tidy up a bit ( I haven't programmed in C for some time );



Frank van Gestel
Posted by: fvgestel

Re: blit-menu - 28/09/2000 19:16

offcourse you can also find it at http://fvgestel.dyndns.org/empeg/

Frank van Gestel
Posted by: Wire

Re: blit-menu - 29/09/2000 07:24

Hi!

Itīs great!

Did you do your own font format or what? I think we ought to reverse-engineer the empeg player's font-format, that way applications could look more consistent than everybody inventing the same stuff over and over.

Source code would be nice when you have the time.




Lars
Posted by: fvgestel

Re: blit-menu - 29/09/2000 09:01

It's the default fixed font used in X, try xterm -fn fixed to get the same font in your xterm. It is possible to replace the ascii.raw file with your own font though.
Most of the code also uses the width and height of the ascii.raw file to dynamically layout the screen. That is still one of the things I would like to change finish before supplying the source.
BTW, I posted blitecho including source a few days ago. blitmenu is based on the same principle...


Frank van Gestel