|
Introduction
My development of libKSD is focussed on two parts; first the creation
of annotated tutorial games and second the creation of a GUI widget
library.
This development takes place outside the ksd core. The functionality
I develop is, or will be, interesting for more game developers so
some of the classes I use in the tutorials will be made available.
See the Extensions section for more on this. The GUI widget library
is discussed further down.
GUI Widget library
The structured set-up of libKSD lends itself well as a base for a GUI
Widget library. The pre1 version even had some example widgets and a
corresponding demo. The interface of these widgets was however not
very sophisticated.
This led me to the idea to extend the interface, and maybe add some
extra widgets. While doing that I found a few other parts which could
be improved. This mostly has to do with text display and processing
functionality. This is clearly not part of the SDL wrapping, as SDL
does only concern itself with text drawing (actually you need SDL_ttf
for that).
On the other hand there is a set of games which use some common GUI
elements like buttons, text input, text output, list boxes, check boxes
and all that and it would be a waste of time for the programmer if
each game programmer would need to implement those himself. That is why
I intend to provide a GUI widget library with the most basic widgets
(and a bit more) that the programmer can use. The widgets will have
a limited themeability so they can adapt to the look-and-feel of
the game. The GUI library is typically not meant for people who like
to create a word processor or browser. If you use the libKSD core
functionality you are also not bound to this gui library; it has its
own namespace and library to link with. You're welcome to use something
different.
Current GUI work
Presently I am re-implementing the TTextBox class. The existing
TTextBox class works perfectly, but requires a lot of user
knowledge of text attributes.
The new TNTextBox is designed to have firstly a bit more functionality
and secondly to have the complicated code split over multiple task
oriented classes for readability and configurability.
TNTextBox uses a TTranslator framework for translation of user strings
to strings with display attributes (fonts, color, size). Current translators
include a default translator which returns the text, and a simple HTML
like parser which parses a string for integrating html-like formatting
commands. These TTranslator derived classes are finished (pending extensive
testing). The user (is the game programmer) may of course create his/her
own TTranslator derived class for custom formatting and the TNTextBox could
then use this class without modifications to all text processing GUI widgets.
TNTextBox also has implemented an input validation system. This by default
does nothing, but could be used to check if the input text represents a
valid integer, or double number. The appropriate TValidator derived classes
exist and can be set to the TNTextBox.
TNTextBox has a flexible wrapping logic. Wrapping is done by a TWrapper
derived class. Work is going on on a TCharWrapper and TWordWrapper. No
wrapping is of course also an option. These are however planned to be
used only internally. Setting the WrapType creates a wrapper of the
appropriate type.
If the TNTextBox is finished (and it's a lot of work) the basis is ready
for GUI widgets. These will be based on the existing TControl I think,
but the design will still take some time. Currently I am planning the
following set of GUI widgets and helper elements:
- Panel: An organizer for other widgets
- Label: Display text (TTranslator determines whether it may be rich text, HTML, ...)
- Button: A normal push button
- TextEdit: Edit one or more lines of (normal, rich, html...) text
- ListView: View listitems
- ListItem: basic element for ListView and ComboBox
- ComboBox: Select an item from a list
- SpinBox: Number display/edit with + and - button
- CheckBox: A Button with a label
- RadioButton: Only one RadioButton in a ButtonGroup can be set
- ButtonGroup: Collect RadioButtons
|