[Kde-games-devel] kspaceduel: porting to Graphics View

Dirk dirkrathlev at gmx.de
Thu Dec 28 16:02:21 CET 2006


Hello,

in order to get rid of some Qt3 support dependencies, I followed this site
http://doc.trolltech.com/4.2/graphicsview-porting.html
and tried to port kspaceduel to Graphics View. I don't know whether this 
is the correct way to go, so I post the patch here before commiting 
anything.


As animation support is removed from QGraphicsPixmapItem which seems to 
be the replacement for QCanvasPixmap, I took some code from the "Ported 
Asteroids Example" 
http://doc.trolltech.com/4.2/graphicsview-portedasteroids.html
This code is GPL 2. kspaceduel is "GPL 2 or later". Is this a problem? 
And is there maybe alrady existing code which meets better kspaceduel's 
requirements?

In addition I encountered heavy performance problems when using a 
QPixmap as background (field.setBackgroundBrush(QBrush(backgr));), so I 
set the background to pure black. Maybe anyone has a solution for this?

Another problem I encountered and couldn't solve by now is that you can 
clicking on the view. If you do so, the arrow keys are "bound" to the 
view and you can't navigate your ship anymore.

I also removed the "rotation" animation of the spaceships and used 
QGraphicsItem::rotate instead.

Until now, *.ppm are used for the grapgics and *.pbm for transparency. I 
planned to convert graphics to *.png and use png's transparency instead.

I'm thinking about porting kspaceduel to SVG, as this seems the way to 
go for kdegames. This is meant as a first step, although I don't know 
whether it's a correct one.

There is still some porting to Qt4 left and after that, I will have to 
do a lot of clean ups and some refactoring. But wanted to post this first.

Please make objections and hints.

Thank you,
Dirk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: port2graphicsview.diff
Type: text/x-diff
Size: 36933 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20061228/4e4ac63b/attachment-0001.bin 


More information about the kde-games-devel mailing list