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

Albert Astals Cid aacid at kde.org
Tue Jun 19 22:45:51 UTC 2012


El Dimecres, 20 de juny de 2012, a les 02:59:47, Viranch Mehta va escriure:
> 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.

Have a look at the KDeclarativeMainWindow implementation, 
http://lxr.kde.org/source/extragear/base/plasma-
mobile/applications/common/kdeclarativemainwindow.cpp
even better if you speak with the authors so maybe you can base your code off 
theirs?

Cheers,
  Albert

> 
> 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


More information about the kde-games-devel mailing list