A quickly-hacked Ruby/SDL menu 'system' intended as a front-end for emulator systems on Raspberry Pi.
But given it's simplicity and portability you may just as well use it for anything you like.
Caveats/Notes:
- Will handle only about a dozen items (no paging whatsoever)
- Will use first joypad; which button is the 'Enter' button will vary across joypads
- The method to execute a command and then return back is a bit hacky (for a reason)
- The
example.rb
is the version I use, thesdlmenu.rb
can be considered development/debug version - Font included came with Ruby/SDL, I hope I'm not gonna get sued for that
- Code is not commented... if something is unclear, treat it as an incentive to learn Ruby
- SDL is low-level, and the interface is not fully consistent with itself, oh well...
To configure, edit at least:
FONT = 'sample.ttf' # you'll want absolute path to your TTF font
MENU = [
['Menu Item One', 'sleep 5'], # 'Title', 'Command'
['Menu Item Two', 'sleep 5'], # and so on...
['Exit', nil], # nil command means exit
]
If you need legalese assume BSD 2-clause license.