[Kde-games-devel] best way to get a sprite from current theme?

Viranch Mehta viranch.mehta at gmail.com
Tue Jun 19 17:28:41 UTC 2012


Hi all,

I've almost completed the QtQuick port of KBreakout (open for alpha
testing, source
can be found here:
http://quickgit.kde.org/index.php?p=scratch%2Fviranch%2Fkbreakout-qml.git), so I
am right now concentrating on retrieving the sprites from theme svgs in
best possible
and fastest manner.

Till now, what I have done is implement a QML element CanvasItem that has
"spriteKey"
property, which is used to retrieve the sprite pixmap using
KGameRenderer::spritePixmap()
method in CanvasItem's paint() method. This is synchronous and slow however.

An alternate I found after digging up the libraries was
KGameRendererClient. I made
CanvasItem its subclass, and reimplemented receivePixmap() to set and paint
the pixmap
received from KGameRendererClient instance. Since this is (as I read in the
docs)
asynchronous, it should be faster than my previous implementation, though
not noticable
on my computer.

I also looked into KGameRenderedPixmap but I think it is intended for use
by QGV.

So I wanted to know if there are any other options like these to even make
the sprite retrieval
faster from the theme svgs.

Thanks,
Viranch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20120619/15f55a20/attachment.html>


More information about the kde-games-devel mailing list