[Kde-games-devel] Review Request: Port KBlocks to KGameRenderer
Parker Coates
parker.coates at kdemail.net
Mon Aug 23 18:39:51 CEST 2010
> On 2010-08-23 08:50:45, Stefan Majewsky wrote:
> > /trunk/KDE/kdegames/kblocks/KBlocksScene.cpp, lines 393-396
> > <http://reviewboard.kde.org/r/5081/diff/1/?file=34367#file34367line393>
> >
> > Could you please do this with setBackgroundBrush, as in the other games, in order to avoid repeated spritePixmap() calls?
>
> Brian Croom wrote:
> I'd love to, but I'm going to need some pointers on the right way to do this. In this case, the scene rect is often considerably smaller than the visualized part of the scene. In other words, the QRectF passed to the scene's drawBackground is different than the sceneRect. So when and where should the background be set? Is this still the responsibility of the scene, which would get the view size through QGraphicsScene::views()? Then I suppose it is necessary to connect a signal so it knows when the view size changes?
You can set the background (by either drawBackground() or setBackgroundBrush()) in either the QGView or the QGScene. So if it makes more sense to do it in the view, feel free to. Do keep in mind that scene coordinates are used either way. If setting the background in the view, you should probably do it in a reimplemented resizeEvent(). If setting it in the scene, you should probably do it where setSceneRect() is called. In this case, updateDimensions().
When I ported Killbots to KGameRenderer I ran into some trouble as my sceneRect doesn't start at (0,0) so I ended up having to "rotate" the pixmap before calling setBackgroundBrush with it. See http://websvn.kde.org/trunk/KDE/kdegames/killbots/scene.cpp?r1=1164840&r2=1164839&pathrev=1164840
- Parker
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/5081/#review7161
-----------------------------------------------------------
On 2010-08-23 01:04:01, Brian Croom wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/5081/
> -----------------------------------------------------------
>
> (Updated 2010-08-23 01:04:01)
>
>
> Review request for KDE Games, Mauricio Piacentini and Stefan Majewsky.
>
>
> Summary
> -------
>
> This straightforward patch makes the KBlocks rendering code use KGameRenderer instead of making its own KGameTheme and QSvgRenderer instances
>
>
> Diffs
> -----
>
> /trunk/KDE/kdegames/kblocks/KBlocksGraphics.h 1166816
> /trunk/KDE/kdegames/kblocks/KBlocksGraphics.cpp 1166816
> /trunk/KDE/kdegames/kblocks/KBlocksItemGroup.cpp 1166816
> /trunk/KDE/kdegames/kblocks/KBlocksScene.cpp 1166816
> /trunk/KDE/kdegames/kblocks/KBlocksSvgItem.h 1166816
> /trunk/KDE/kdegames/kblocks/KBlocksSvgItem.cpp 1166816
> /trunk/KDE/kdegames/kblocks/main.cpp 1166816
>
> Diff: http://reviewboard.kde.org/r/5081/diff
>
>
> Testing
> -------
>
> I have tested playing games and switching themes, and encountered no problems.
>
>
> Thanks,
>
> Brian
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-games-devel/attachments/20100823/540b0316/attachment-0001.htm
More information about the kde-games-devel
mailing list