VoltAir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Joints.h
1 /*
2  * Copyright (C) 2014 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef JOINTS_H
18 #define JOINTS_H
19 
20 #include <QObject>
21 
22 class Body;
23 class RevoluteJoint;
24 class WeldJoint;
25 
30 class Joints : public QObject {
31  Q_OBJECT
32 public:
33 
39  Q_INVOKABLE RevoluteJoint* createRevoluteJoint(Body* joiner, Body* joinee);
40 
47  Q_INVOKABLE WeldJoint* createWeldJoint(Body* joiner, Body* joinee);
48 
52  static Joints* getInstance();
53 private:
54  Joints(QObject* parent = nullptr);
55 
56  static Joints* sInstance;
57 };
58 Q_DECLARE_METATYPE(Joints*)
59 
60 #endif // JOINTS_H
A QObject container for a Box2D b2Body.
Definition: Body.h:57
A constraint that fixes the distance between each Bodys anchor point.
Definition: RevoluteJoint.h:27
static Joints * getInstance()
Returns the Joints singleton.
Q_INVOKABLE WeldJoint * createWeldJoint(Body *joiner, Body *joinee)
Creates a WeldJoint.
Factory class for creating Joints from QML.
Definition: Joints.h:30
Q_INVOKABLE RevoluteJoint * createRevoluteJoint(Body *joiner, Body *joinee)
Creates a RevoluteJoint.
A constraint that fixes the relative positions of two Bodys.
Definition: WeldJoint.h:26
QObject * parent() const