Blog posted by JPickford on Mon, 13 Apr 2009
Subject: Magnetic Billiards: Seriously Casual
Perhaps not the most exciting image I've posted but this is what I've been up to this week. For some reason I really enjoy working on this kind of interface stuff.
A while back I added a windowing system to Magnetic Billiards. It works with a simple mark-up language which allows us to mix text and images and have keywords which provide hyperlinks to other windows. This has been very useful in presenting all the help information for the game and the script driven nature means Ste can easily add content without needing me to recompile anything.
More recently I added a couple of dynamic elements; buttons and text entry fields. These were needed for the more interactive help stuff we've added lately and to allow multiple usernames / accounts on one PC.
Buttons in the current implementation are images but we realised that buttons with text in them would be very useful (particularly for our new project which is already underway). Whilst implementing a new kind of button with a text field is fairly straightforward I thought it would make more sense if those buttons were actually fully scripted windows so we could make full use of the mark-up language, mixing text and images etc.
This all went pretty smoothly but the clipping of the windows was almost too much for my tiny brain. There was already a simply clipping system which clipped the contents of the window against the window itself (allowing for the window to be resized and the content to scroll) but the actual border and background of the window didn't need clipping. To get sub windows to work I had to make that stuff clippable but also clip the contents of the sub-window according to the state of it's parent window as well it's own state. This quickly gets recursive and a right headscratcher.
Thankfully I got it all straight with some reasonably elegant code during a bit of a late-night coding session with the help of a bottle or two of Leffe Blond.