Hey guys,
I thought it would be a good idea to have a good, flexible menu system for emulators and such to ease the porting of emulators from computers with keyboards and mice and such to a console with only a stick and buttons.
Here is an example of what I've been writing over the past three days:
http://elektron.ewi.tudelft.nl/~brouwe25/menu.zip
Included is an SDL based win32 .exe and the main.cpp wich should illustrate how it works from a programmers perspective. The main idea is that you can create a tree of Menu objects, and simply call the 'enter' function on the root to bring up the menu. It's possible to create subclasses of menu, with different functionalities. Right now I have a checkbox (for turning things on/off), a select box (for choosing between different screen scaling methods for instance) and an action item (fires a callback function when selected). I plan to write a filebrowser as well.
The next thing I want to do is to allow nodes to have a (name,value) tuple, so you can call a save method on the rootnode that will save the entire menustate to a file, and ofcourse a load as well. This way you don't have to write a new config file saver/loader everytime.
I wrapped the SDL surface, so even though internally it's all 24bit, it could also work on gp32 with a little work. I also wrapped the SDL event polling thingie, so that should be easy to port to a non-SDL environment as well. It's all still very unoptimized, but it's a wip
Any thoughts, suggestions?
I thought it would be a good idea to have a good, flexible menu system for emulators and such to ease the porting of emulators from computers with keyboards and mice and such to a console with only a stick and buttons.
Here is an example of what I've been writing over the past three days:
http://elektron.ewi.tudelft.nl/~brouwe25/menu.zip
Included is an SDL based win32 .exe and the main.cpp wich should illustrate how it works from a programmers perspective. The main idea is that you can create a tree of Menu objects, and simply call the 'enter' function on the root to bring up the menu. It's possible to create subclasses of menu, with different functionalities. Right now I have a checkbox (for turning things on/off), a select box (for choosing between different screen scaling methods for instance) and an action item (fires a callback function when selected). I plan to write a filebrowser as well.
The next thing I want to do is to allow nodes to have a (name,value) tuple, so you can call a save method on the rootnode that will save the entire menustate to a file, and ofcourse a load as well. This way you don't have to write a new config file saver/loader everytime.
I wrapped the SDL surface, so even though internally it's all 24bit, it could also work on gp32 with a little work. I also wrapped the SDL event polling thingie, so that should be easy to port to a non-SDL environment as well. It's all still very unoptimized, but it's a wip
Any thoughts, suggestions?
