Eric
Bischoff
Maren
Pakura

    maren@kde.org

Deutsche Übersetzung
2002-04-10
0.03.02
KDE
KTuberling
Technische Referenz (in englisch)

# Technische Referenz (in englisch)

&ktuberling; offers a gentle and rewarding introduction to &kde; customization and programming. The application can be extended. For example, without any coding, new playgrounds can be added by changing the graphics files. By adding appropriate sound files, translators can change the sounds to their native tongue!

If you extend or add to the game please consider sending your additions to the developer Eric Bischoff for inclusion in future releases.

## For artists

The first type of images, `*-game.png` holds the playground and the objects that the user selects. This is the graphic that the user sees when playing the game.

The second type of images, `*-mask.png`, contains only masks of the objects. The masks are used to delimit the borders of the objects and, in some cases, give the object some transparancy (for example, the spectacles). It is mandatory to put the objects at the same position in the gameboard file as in the mask file.

Still in the same directory, a file named `layout.i18n` (`$KDEDIR/share/apps/ktuberling/pics/layout.xml`) recapitulates the strings in `layout.xml` that can be translated:

- The names of the categories of objects

## Translation

Besides the usual `.po` files mechanism for translating program labels and prompts, the sounds can be localized too.

In a future release, &ktuberling; will use OGG Vorbis rc3 file format for sounds. At that moment, it will be possible to convert the WAV files to OGG Vorbis rc3 through the following command line:

    $ oggenc_rc3 -o sound.ogg sound.wav

Information on how to work with the translation mechanisms in &kde; is available in The KDE Translation HOWTO.

## For programmers

&ktuberling; isn't really difficult to extend for programmers.

### C++ classes

`TopLevel`

  Top-level window and basic program management

``

`ToDraw`

  Description of one of the graphical objects to be drawn

``

``

### `.tuberling` files structure

A `.tuberling` file holds all the necessary data to redraw a tuberling. It can be edited with an ordinary text editor.

The first line holds the number of the playground.

On all other lines, there is one graphical object per line, in the order that is used to draw them. Each line contains 5 numbers: the identifier of the object, and the rectangle where it should be drawn (left, top, right, bottom). The numbers are separated by whitespaces.

## Structure of the layout file (`layout.xml`)

The <playground> tag has two attributes: gameboard and masks. These attributes give the name of the files holding the pictures. The <playground> tag also contains one <menuitem> tag, one <editablearea> tag, several <category> tags, and several <object> tags.

The <menuitem> tag describes the action identifier of the menu item allowing to select position of the area where you can drop objects, and the label of this menu item. This action identifier should be identical to the one in `ktuberlingui.rc`.

The <category> tag describes the position and the label of a text describing a group of objects. For example, it can describe the position and the text of the group of goodies.

The lower level tags are not explained here, since their meaning is quite straightforward. If you modify `layout.xml`, don't forget to modify `layout.i18n` and `ktuberlingui.rc` accordingly.