[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Driftwood Interface Code
<http://kschnee.xepher.net/code/Driftwood%20Demo.zip>
<http://kschnee.xepher.net/pics/070428driftwood.jpg>
Here's a revised version of my interface code, Driftwood. So far I've
got a basic widget, a button, and a multi-line text display, plus an
optional system for coordinating the various screens of a game. I'd
released a version of Driftwood before, but this one has better-designed
code that's hopefully easier to understand. The standard window border
also looks better than before. It's free software, and I plan to release
a version with more classes the same way.
The demo shows a mock title screen with a working Quit button and an
Options button that takes you to a mock options screen. The options
screen has a Back button, a text area, and a test button that adds text
to the text area. There's also a simpler demo class.
Unlike last time, the widgets normally draw directly to the screen
instead of blitting completely to a hidden surface and updating only
sometimes. Each widget knows its actual screen position and isn't
confined to the area of its official parent widget.
I'm having a hard time figuring out the exact scrolling behavior I want
in the TextDisplay class. It's meant to do this when told to add text:
-Add the new rendered text one character at a time to my display
surface, part of which is blitted each frame to the screen so that I can
hold more text than is actually shown.
-If the next character would be drawn to a spot below the currently
visible area, move the visible area down by one line.
-If the next character would actually go below the drawing surface, copy
a chunk of the current text upwards by one line, and clear the bottom line.
Not sure how to handle deletion of text either.
Kris