<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="http://svn.reviewboard.kde.org/r/7017/">http://svn.reviewboard.kde.org/r/7017/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On August 9th, 2012, 10:50 p.m., <b>David Edmundson</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
<thead>
<tr>
<th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
<a href="http://svn.reviewboard.kde.org/r/7017/diff/2/?file=48265#file48265line43" style="color: black; font-weight: bold; text-decoration: underline;">trunk/KDE/kdegames/libkdegames/declarativeimports/canvasitem.h</a>
<span style="font-weight: normal;">
(Diff revision 2)
</span>
</th>
</tr>
</thead>
<tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
<tr>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<td colspan="2"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">public:</pre></td>
</tr>
</tbody>
<tbody>
<tr>
<th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
<th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">43</font></th>
<td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "> <span class="k">static</span> <span class="kt">void</span> <span class="n">setRenderer</span><span class="p">(</span><span class="n">KGameRenderer</span><span class="o">*</span><span class="p">);</span></pre></td>
</tr>
</tbody>
</table>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">If you tried inserting two KgDeclarativeViews in an app, this now breaks heavily.
In the context of KBattleship (for example) that would be a perfectly sensible looking thing to do.
However, given a QML creatable item needs to have a default constructor, I can see why you've done this. </pre>
</blockquote>
<p>On August 11th, 2012, 12:54 p.m., <b>Viranch Mehta</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Well I could add a check before to decide whether to call this. This would be assuming, of course, that you want to use a common KGameRenderer for both the KgDeclarativeViews.
Is it possible that a single game uses two different KGameRenderers?</pre>
</blockquote>
<p>On August 11th, 2012, 1:10 p.m., <b>David Edmundson</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Then it's KGameRenderer that needs to be a singleton, not a static pointer in the classes using it.</pre>
</blockquote>
<p>On August 11th, 2012, 11:05 p.m., <b>Ian Wadham</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Yes. KGoldrunner when ported to QGV will be using two, because each theme has two SVG files: one for the runners and the other for the background and tiles. Also I believe Granatier already has more than two KGameRenderers.</pre>
</blockquote>
<p>On August 12th, 2012, 6:03 a.m., <b>Viranch Mehta</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Then this also raises the issue of using multiple renderers within single declarative view. It becomes necessary to specify which renderer to use for each CanvasItem instance, which makes this very complicated.
A potential solution is writing a QML component for KGameRenderer too, like:
KgCore.Renderer {
id: backgroundRenderer
/* some properties that enable finding the path to the themes */
}
KgCore.Renderer { id: tilesRenderer; /* ... */ }
CanvasItem {
id: tile1
renderer: tileRenderer
}
CanvasItem {
id: background1
renderer: backgroundRenderer
}
and so on...
what do others think?</pre>
</blockquote>
</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I am not that well acquainted with QML, so cannot comment. In KGoldrunner I simply wrote a class, KGrRenderer, that hid the fact that there are two renderers and had methods for getting pointers to KGameRenderedItem's for tile, background, etc. I guess you are doing something like that here.
Two advantages of KGrRenderer are that it can hide the translation from the model's internal codes to SVG element names and it can auto-delete when one item is replaced by another (or by empty space), as the game moves from level to level. So it is a bit more than a wrapper for two KGameRenderer's.</pre>
<br />
<p>- Ian</p>
<br />
<p>On August 9th, 2012, 9:42 p.m., Viranch Mehta wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://svn.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for KDE Games.</div>
<div>By Viranch Mehta.</div>
<p style="color: grey;"><i>Updated Aug. 9, 2012, 9:42 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This patch contains some new stuff for libkdegames mainly to support future porting of KDE games to QtQuick/QML. Post this patch, libkdeclarative becomes a dependency for libkdegames.
There are two new things:
1. KgDeclarativeView:
This is a QDeclarativeView with KDE-specific import paths for QML components configured and javascript functions bindings added (like i18n() methods) using the KDeclarative library. If the view is supplied with a KGameRenderer object, it is added to the underlying declarative engine so that it can be used by QML components built for use in QML ports.
2. CanvasItem QML component(the name of the component can be changed as per suggestions):
This is a QML component that simply loads specified sprite pixmap from the theme provided by the KGameRenderer. The component uses the KGameRenderer instance from the engine (as set by the KgDeclarativeView) and loads the theme-specific sprite pixmap. The sprite retrieval is asynchronous and is done by using KGameRendererClient, this has potential for performance improvements.
The documentation on how to use these is inline with the code.
The kgdeclarativeview{.h,.cpp} are in libkdegames and the QML component is in declarativeimports/ directory.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Tested with my the ongoing port of KBreakout, works as expected.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>trunk/KDE/kdegames/libkdegames/CMakeLists.txt <span style="color: grey">(1309184)</span></li>
<li>trunk/KDE/kdegames/libkdegames/declarativeimports/CMakeLists.txt <span style="color: grey">(PRE-CREATION)</span></li>
<li>trunk/KDE/kdegames/libkdegames/declarativeimports/canvasitem.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>trunk/KDE/kdegames/libkdegames/declarativeimports/canvasitem.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>trunk/KDE/kdegames/libkdegames/declarativeimports/corebindingsplugin.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>trunk/KDE/kdegames/libkdegames/declarativeimports/corebindingsplugin.cpp <span style="color: grey">(PRE-CREATION)</span></li>
<li>trunk/KDE/kdegames/libkdegames/declarativeimports/qmldir <span style="color: grey">(PRE-CREATION)</span></li>
<li>trunk/KDE/kdegames/libkdegames/includes/CMakeLists.txt <span style="color: grey">(1309184)</span></li>
<li>trunk/KDE/kdegames/libkdegames/includes/KgDeclarativeView <span style="color: grey">(PRE-CREATION)</span></li>
<li>trunk/KDE/kdegames/libkdegames/kgdeclarativeview.h <span style="color: grey">(PRE-CREATION)</span></li>
<li>trunk/KDE/kdegames/libkdegames/kgdeclarativeview.cpp <span style="color: grey">(PRE-CREATION)</span></li>
</ul>
<p><a href="http://svn.reviewboard.kde.org/r/7017/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>