[Kde-games-devel] thoughts about QML support in libkdegames

Viranch Mehta viranch.mehta at gmail.com
Tue Jun 19 21:29:47 UTC 2012


Hi all,

I was thinking about how we can add stuff to libkdegames for making
porting games to QML a little easier and less messier. I came up with
following ideas:

1. A QML component for rendering and painting sprites from a given
theme provider. This could be done by reimplementing QDeclarativeItem
that paints the sprite pixmap which is rendered by a KGameRenderer,
which is instantiated using the given KgThemeProvider.
(Thoughts/comments required for the name of this QML component)

2. A KgDeclarativeView, that is essentially a subclass of QDeclarativeView
but adds the kdeclarative sauce on top of it to add KDE's import paths for
custom QML components (like above), add bindings for i18n, etc. support.
In addition, this class takes a KgThemeProvider in its constructor, which
is set as a context property in the declarative engine's root context. This
property is used by the above QML component to get the theme provider
from the engine and use it to initialize a renderer.

After the above two, a developer would simply add a KgDeclarativeView
as the central widget of main window (providing it with the desired theme
provider) and load the source qml files. The qml source can simply import
relevant plugin for using the qml component for showing the sprites.

I managed to gather up a rough proof of concept code, but needs reviewing
since I'm not very good at cmake and linking libraries kind of things. Also
I
don't know where the above code would go. A separate kgdeclarative library
inside libkdegames or simply in its root folder? I'll post a review request
after
I'm clear with such doubts.

Thoughts/comments?

Cheers,
Viranch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20120620/2d6488ba/attachment.html>


More information about the kde-games-devel mailing list