Had a go at trying to make modal gadgets yesterday. Not going to happen. Not in a clean way, anyhow. There are just too many problems. If I moved a lot of the physical event handling into the Gadget class out of the Woopsi class, I’m still left with a lot of problems:
- How can I increase the VBL count?
- How can I manage the context menu?
- How can I manage the deletion queue?
There are plenty of other questions along the same lines. It’s possible, but the solutions would be very ugly. For the most part, Woopsi’s code is quite tidy at the moment and I don’t want to start kludging it up.
Instead, I’ve implemented a “ModalScreen” class, which consists of about 2 lines of code. It’s just a Screen class that calls “erase()” in its draw function, making it transparent. Since it fills the entire screen, it blocks access to any gadgets in lower screens and thus makes its own children modal. No kludges, one (tiny) extra class. Neat!
There are now “shelved” and “unshelved” events, which get triggered when gadgets are shelved or unshelved. The hide() and show() methods now trigger the hidden/shown events properly.
Lastly, I’ve made some updates to the documentation. The calculator tutorial should now work, as should the “hello world” tutorial. I’ve tidied up a few other things. Whilst I’m on the docs topic, I’ve switched the Woopsi web link on the SourceForge site to this blog. It should get me a bit more traffic and reduce the negative impact of the out-of-date documentation.
Oh, one last thing. There’s a new version of DeSmuME out (0.8) for Windows, OSX and Linux. This version works with Leopard.