[gluon] Re: qt physics 2d

[ Thread Index | Date Index | More lists.tuxfamily.org/gluon Archives ]



I will not be on the channel often. But You can ask leinir about it.
About your library, I was thinking something like this : 

-  Create a qphysics core library ( c++ class wrapping of box2d)
-  Create class to use QGraphicsView and QPhysics . 

The library should be like this : 

Box2d ->  Qt/C++ class  Physics   ->  Render

it would be nice if the render can be switch with different render system. For example QGraphicsView or OpenGL. So that's why I suggest to create wrapping c++ class around Box2d like you started already. 
As i see on your code, you didnt proceed like this. You created directly the render on the top of box2d :   Box2d -> Render



We will use qt coding style : http://doc.trolltech.com/qq/qq13-apis.html  . There just are 2 things to remember : 
Class file name in lowercase :   qphysicsworld.cpp and not QPhysicsWorld.cpp

a class definition is like this : 

class QPhysicsWorld : public QObject
{
Q_OBJECT
public:
QPhysicsWorld(QObject * parent);
void setConstantGravity(int value);
int constantGravity();

Q_SLOTS:
void setGravity(QVector2d vector);

private:
int mConstantGravity;
QVector2d mGravity;

}


Here some example about the Qt/C++ physics Core around box2d following this class architecture : http://www.linuxuser.at/elements/doc/box2d/hierarchy.htm
We can use a namespace or a prefix class:
namespace :   QPhysics::World    or   QPhysicsWorld. 

QPhysicsWorld
QPhysicsShape
QPhysicsBody
QPhysicsJoint
    QPhysicsDistanceJoint
    QPhysicsRevoluteJoint
    etc....



Here some example about render class using QGraphicsView

QPhysicsItem
     - QSolidItem .... 
like you already done...

So, I will get more time after my exam in 2 week. Then I will start codding with you, if you want. be free to ask questions. 
Sorry for my english, I m french.

See you !!


2010/6/7 Jon <jon.e.mundall@xxxxxxxxx>
Oh Hey! Wow! Glad to see some interest in the project! Sorry to be so bad
about getting back to you, I just got back from a weekend hike! :) fun stuff!

I'll get on the freenode channel sometime and discuss details with you.

Thanks,
Jon

On June 5, 2010 05:49:17 am you wrote:
> you are welcome on irc  :   irc.freenode.net channel : #gluon to talk about
>
> 2010/6/5 idk <istdasklar@xxxxxxxxx>
>
> > More information :
> >
> > We are using libbox2d into KDE/gluon.
> > It would be greate to have a qt library wrapping box2d.
> > As I see, you start a C++/Qt port. We want to do the same .
> >
> > If you are interesting, please create an account on gitorious. And then
> > you will be welcome as a gluon member as developpers of qphysics.
> >
> > 2010/6/5 idk <istdasklar@xxxxxxxxx>
> >
> > Hello,
> >
> >> Could you put your qt physics lib on gitorious ?
> >> I would be happy to help you with my team, to improve it.
> >>
> >> DrIDK from Kde / Gluon team



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/