
Today I got a Swing-ish menu system for the game sort-of working. It's just the rendering (minus animation) at the moment. Above you can see a VerticalFlowLayout container holding three HorizontalFlowLayout containers, each holding a few 'atomic' elements, in this case images. String support is more-or-less implemented but I couldn't be fucked dealing with wrapping at 1am so I had a beer and a banana instead (undecided about that triple-filtered Stella- it's not bad).
The nice thing about the system is that it is recursive and will trigger a full re-layout every time you add a new element, and automagically stretch to fit them as they are added. Padding and borders are supported at every level.
I didn't use TDD- I wasn't sure how I would do a test for a menu system or how much I should presume to get done, whether I should write tests for animation or not, etc. When it came to the point where I assumed the implementation was complete, I went to build my menu and realised I didn't have a clear idea how I was going to use it, and ended up making a good few changes- so now I definitely see the advantage in TDD! With TDD I would have thought about this from the start. I'm still not sure how to go about testing something so visual, to be honest.
So anyway, it remains to include input response, button states, and potentially animation. Oh, and background images. Thinking about it, I don't know why the fuck I have the concept of 'atomic' elements- they should all be potential containers, then background images would be supported intrinsically. Probably a simple change. Oh well, it's late.