Developer Guide - Creating a Simple GUI
Here are some guidelines you might find useful when building applications with Woopsi.
- If you are creating a small application, create your application as a class rather than as a set of functions in main.cpp. You can make that class into an event handler simply by inheriting from the base EventHandler class, and all of your handler code will be in the same scope as the rest of your code. It makes things much easier.
- Use the event system instead of trying to access the DS' input hardware directly/the PALib input structs/Woopsi's PALib input abstraction layer. When using PALib, the stylus code in particular won't give accurate information after it has been read for the first time, so either your application or the Woopsi GUI code won't run properly if you interfere with Woopsi's normal input handlers. Using the event handlers also has the benefit of allowing your code to run natively on your development platform if you compile it using the SDL code.
- Use the SuperBitmap gadget for drawing to windows. Standard windows do not store the graphics contained within them in order to save memory, so if you draw to a window and then refresh that window, anything you've drawn will be lost. The SuperBitmap stores its graphics in RAM and refreshes the display as required.
- Woopsi will delete its entire hierarchy when it gets deleted. You don't need to delete any gadgets that have been added into the Woopsi hierarchy. Attempting to delete gadgets still inside the hierarchy will inevitably lead to crashes.
- Look at the supplied demos for example implementations of Woopsi.