[Qt-interest] Howto Do `hit Test' with QGraphicsItems ?

Aaron Lewis aaron.lewis1989 at gmail.com
Thu May 6 03:37:49 CEST 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/05/2010 07:05 PM, Sean Harmer wrote:
> Hi,
> 
> On Wednesday 05 May 2010 11:47:53 Aaron Lewis wrote:
>> Hi,
>> 	I'm deploying a small game , which i need to set up some `edges'. I've
>> learned the term hitTest from Flash , kinda of collision detections.
>>
>> 	e.g I have a wall around a map , and player should not get out of the
>> yard , any move towards a wall is disallowed.
>>
>> 	So far what i tried is to take advantage of coordinate system.
>> 	Rely on each items' pos() function with their image size , not so good
>> anyway.
>>
>> 	Does anyone has any good ideas ?
>>
>> 	Appreciate any of your help ;-)
> 
> What you are looking for is QPainterPath QGraphicsItem::shape() const:
> 
> http://doc.qt.nokia.com/4.7-snapshot/qgraphicsitem.html#shape

Yeah , useful for setting a rectangle bound of an QGraphicsItem.

Thanks Sean.

> 
> Have fun!
> 
> Sean
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest


- -- 
Best Regards,
Aaron Lewis - PGP: 0x4A6D32A0
FingerPrint EA63 26B2 6C52 72EA A4A5 EB6B BDFE 35B0 4A6D 32A0
irc: A4r0n on freenode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkviHW0ACgkQvf41sEptMqB+ygCfXseyi/36YhIEJPKpcmCjP1ni
WPkAn2e3KXLrCMx7cr3ajT7Klrb94zgj
=e2yK
-----END PGP SIGNATURE-----



More information about the Qt-interest-old mailing list