[Kde-games-devel] SVG Card backs
Martin Heni
kde at heni-online.de
Fri Apr 27 17:30:36 CEST 2007
I copied some (3) card backs from the SVG cardsets into the card back "decks"
directory so that programs now can also access the card backs via KCardDialog
as SVG. Analogously, to the card sets, I added the (optional) config entry
"SVG" which points to the SVG file. The image itself needs to have the SVG id
"back" like the SVG cardecks already introduced.
The SVG cardset still has to have a PNG preview picture, e.g. "deck25.png".
The preview PNG is used for display in the carddialog but can also be used by
non SVG games as game image. In this way the change is fully compatible for
old games. Games can but need not access the SVG image.
"deck25.desktop" looks like:
[KDE Cards]
Name=Dondorf (SVG)
SVG=deck25_dondorf.svgz
Comment=SVG Dondorf
and the card back has following files
decks/deck25.desktop
decks/deck25_dondorf.svgz
decks/deck25.png
Lskat utilizes these carddecks now. It can be tested by selecting one of the
last three decks in the KCardDialog, e.g. above mentioned "Dondorf (SVG)".
Usage from the program is failry easy. The KCardDialog is not changed and
provides a path to the PNG image, e.g. "/home/kde/.../decks/deck25.png". From
this path the other files can be deduced. Whether it is necessary to provide
access functions for desktop file and SVG file in KCardDialog can be
discussed. Having them would make accessing the files easier.
btw. on Question: I could not find a Qt function to get the directory part of
above filename , that is one needs "/home/kde/.../decks/" when having
"/home/kde/.../decks/deck25.png" to append then the SVG filename. I manually
search the last "/" (Actually QDir::separator()) but I would prefer to use a
Qt "dirname" function. Any ideas?
More information about the kde-games-devel
mailing list