[Kde-games-devel] Re: Quick question on QCanvasSprite

Nathan Humbert humbna at mirage.aswwc.net
Sun Aug 3 19:58:17 CEST 2003


On Sunday 03 August 2003 03:40 pm, Andreas Beckermann wrote:
> On Sunday 03 August 2003 05:09, Nathan Humbert wrote:
> > How would someone go about rotating the graphics in a QCanvasSprite?
> >
> >
> > Thanks,
> > Nathan Humbert
> > humbna at mirage.aswwc.net
>
> Dunno what you mean by "quick" question...
> Well, maybe an easy answer exists, but I doubt it, as QCanvasSprite
> operates on pixmaps only.
> So I believe the "best" way to achieve this (and the only I can think of
> atm) is to rotate the sprites in advance and use an array (ahem: list) of
> rotated pixmap when constructing the sprite.
> Yes, this takes a lot of memory. Yes,  you won't be able to use all
> rotation factors and yes, this situation is getting even worse if you are
> already using animations in your sprite (and then need to provide rotations
> for every frame).
> You may be able to do some tricky code using QCanvasSprite::setSequence()
> in case you need animations. Then you can avoid storing several MB of
> pixmaps.
>
> You can use QPixmap::xForm() to get a rotated pixmap, I guess.
> QWMatrix::rotate() should do nearly all of the work.
>
> Are you sure you need rotations _and_ QCanvas? What kind of game/program
> are you doing?
>
Thanks for the suggestions,
Seeing as how it doesn't look easy I think I will just rotate the graphic 
before putting it into the sprite

I am working on a Frogger clone, and what I was going to use the rotations for 
was turning the car graphics around for the other lane of traffic. So 
rotating the graphic before using it is an acceptable solution.

Later
Nathan

> CU
> Andi
> _______________________________________________
> kde-games-devel mailing list
> kde-games-devel at mail.kde.org
> http://mail.kde.org/mailman/listinfo/kde-games-devel



More information about the kde-games-devel mailing list