[Kde-games-devel] SoK Project: Writing a Game for KDE in QML

Stefan Majewsky stefan.majewsky at googlemail.com
Sat May 12 20:53:54 UTC 2012


On Tue, May 1, 2012 at 4:34 PM, Sidharth Bansal
<sidharthbansal.sb at gmail.com> wrote:
> Please help me in starting. Rest everything i will manage.

Hm, so it has already been 11 days since I last checked my mail
thoroughly. D'oh...

You'll need a recent version of libkdegames, quite some API is
changing in the 4.9 relase, and you probably want to use the new
classes instead of the old API which will vanish in the new release.
Since libkdegames still resides in SVN, get it like this:

    svn checkout -N svn://anonsvn.kde.org/home/kde/trunk/KDE/kdegames
    cd kdegames
    svn update cmake libkdegames libkmahjongg

This clones kdegames, but only the libraries. You'll probably not want
to compile all the games if you only need the library for your own
game. If you want the games, omit "-N" from the first line and skip
the last command. ("-N" checks out the kdegames directory without any
subdirectories, and the "svn update" fetches you the directories which
you need to compile the kdegames libraries).

    mkdir build
    cd build
    cmake ..
    make
    [sudo] make install

The standard CMake compilation procedure, here. If you're installing
to a custom installation prefix (which you should in order not to
pollute your /usr), give -DCMAKE_INSTALL_PREFIX=/path/to/install to
the cmake call.

Now that you got the library, you can start your application. At this
point, I recommend that you read into the development tutorials on
techbase.kde.org (it's linked on the frontpage there), as an addition
to the excellent Qt tutorials. The following will be interesting to
you:

    (*) Basics -> Hello World
    (*) Basics -> Introduction to CMake
    Basics -> Desktop File
    Basics -> Common Programming Mistakes
    Testing and debugging -> Debugging your application
    Managing configuration data -> Introduction to KConfig
    Managing configuration data -> Using KConfigXT
    (*) Localization -> Writing Apps with Localization in Mind

Those marked (*) you should read immediately if you're not familiar
with the topics. As for the other ones, quickly skim over the
introduction to know what they're about, and remember them once you
need them. (KConfig, for example, is a great way to implement a save
file format in no time.)

For API references, keep the Qt documentation (qt-project.org/doc) and
api.kde.org under your pillow. Docs for libkdegames are also available
on api.kde.org (look for "kdegames" in the module list on the
frontpage, and be sure to use the unstable API.)

And if something is still unclear, the source is the reference.
kdegames is a big realm of example code. ^^

All this is for traditional C++-based Qt/KDE programming. KDE also has
QML APIs, in libkdeclarative, but I don't know where to find tutorials
or documentation for that one. Ask the Plasma people...

Greetings
Stefan


More information about the kde-games-devel mailing list