File indexing completed on 2024-04-21 14:43:25
0001 /* 0002 * box2dplugin.cpp 0003 * Copyright (c) 2010-2011 Thorbjørn Lindeijer <thorbjorn@lindeijer.nl> 0004 * Copyright (c) 2011 Daker Fernandes Pinheiro <daker.pinheiro@openbossa.org> 0005 * Copyright (c) 2011 Joonas Erkinheimo <joonas.erkinheimo@nokia.com> 0006 * 0007 * This file is part of the Box2D QML plugin. 0008 * 0009 * This software is provided 'as-is', without any express or implied warranty. 0010 * In no event will the authors be held liable for any damages arising from 0011 * the use of this software. 0012 * 0013 * Permission is granted to anyone to use this software for any purpose, 0014 * including commercial applications, and to alter it and redistribute it 0015 * freely, subject to the following restrictions: 0016 * 0017 * 1. The origin of this software must not be misrepresented; you must not 0018 * claim that you wrote the original software. If you use this software in 0019 * a product, an acknowledgment in the product documentation would be 0020 * appreciated but is not required. 0021 * 0022 * 2. Altered source versions must be plainly marked as such, and must not be 0023 * misrepresented as being the original software. 0024 * 0025 * 3. This notice may not be removed or altered from any source distribution. 0026 */ 0027 0028 #include "box2dplugin.h" 0029 0030 #include "box2dworld.h" 0031 #include "box2dbody.h" 0032 #include "box2ddebugdraw.h" 0033 #include "box2dfixture.h" 0034 #include "box2djoint.h" 0035 #include "box2ddistancejoint.h" 0036 #include "box2dprismaticjoint.h" 0037 #include "box2drevolutejoint.h" 0038 #include "box2dmotorjoint.h" 0039 #include "box2dweldjoint.h" 0040 #include "box2dpulleyjoint.h" 0041 #include "box2dfrictionjoint.h" 0042 #include "box2dwheeljoint.h" 0043 #include "box2dmousejoint.h" 0044 #include "box2dgearjoint.h" 0045 #include "box2dropejoint.h" 0046 #include "box2dcontact.h" 0047 #include "box2draycast.h" 0048 0049 const int versionMajor = 2; 0050 const int versionMinor = 0; 0051 0052 Box2DPlugin::Box2DPlugin(QObject *parent) : 0053 QQmlExtensionPlugin(parent) 0054 { 0055 } 0056 0057 void Box2DPlugin::registerTypes(const char *uri) 0058 { 0059 #if !defined(STATIC_PLUGIN_BOX2D) 0060 Q_ASSERT(QLatin1String(uri) == QLatin1String("Box2D")); 0061 #endif 0062 0063 qmlRegisterType<Box2DWorld>(uri, versionMajor, versionMinor, "World"); 0064 qmlRegisterUncreatableType<Box2DProfile>(uri, versionMajor, versionMinor, "Profile", 0065 QStringLiteral("Property group of World")); 0066 qmlRegisterType<Box2DBody>(uri, versionMajor, versionMinor, "Body"); 0067 qmlRegisterUncreatableType<Box2DFixture>(uri, versionMajor, versionMinor, "Fixture", 0068 QStringLiteral("Base type for Box, Circle etc.")); 0069 qmlRegisterType<Box2DBox>(uri, versionMajor, versionMinor, "Box"); 0070 qmlRegisterType<Box2DCircle>(uri, versionMajor, versionMinor, "Circle"); 0071 qmlRegisterType<Box2DPolygon>(uri, versionMajor, versionMinor, "Polygon"); 0072 qmlRegisterType<Box2DChain>(uri, versionMajor, versionMinor, "Chain"); 0073 qmlRegisterType<Box2DEdge>(uri, versionMajor, versionMinor, "Edge"); 0074 qmlRegisterType<Box2DDebugDraw>(uri, versionMajor, versionMinor, "DebugDraw"); 0075 qmlRegisterUncreatableType<Box2DJoint>(uri, versionMajor, versionMinor, "Joint", 0076 QStringLiteral("Base type for DistanceJoint, RevoluteJoint etc.")); 0077 qmlRegisterType<Box2DDistanceJoint>(uri, versionMajor, versionMinor, "DistanceJoint"); 0078 qmlRegisterType<Box2DPrismaticJoint>(uri, versionMajor, versionMinor, "PrismaticJoint"); 0079 qmlRegisterType<Box2DRevoluteJoint>(uri, versionMajor, versionMinor, "RevoluteJoint"); 0080 qmlRegisterType<Box2DMotorJoint>(uri, versionMajor, versionMinor, "MotorJoint"); 0081 qmlRegisterType<Box2DWeldJoint>(uri, versionMajor, versionMinor, "WeldJoint"); 0082 qmlRegisterType<Box2DPulleyJoint>(uri, versionMajor, versionMinor, "PulleyJoint"); 0083 qmlRegisterType<Box2DFrictionJoint>(uri, versionMajor, versionMinor, "FrictionJoint"); 0084 qmlRegisterType<Box2DWheelJoint>(uri, versionMajor, versionMinor, "WheelJoint"); 0085 qmlRegisterType<Box2DMouseJoint>(uri, versionMajor, versionMinor, "MouseJoint"); 0086 qmlRegisterType<Box2DGearJoint>(uri, versionMajor, versionMinor, "GearJoint"); 0087 qmlRegisterType<Box2DRopeJoint>(uri, versionMajor, versionMinor, "RopeJoint"); 0088 qmlRegisterType<Box2DRayCast>(uri, versionMajor, versionMinor, "RayCast"); 0089 0090 qmlRegisterUncreatableType<Box2DContact>(uri, versionMajor, versionMinor, "Contact", QStringLiteral("Contact class")); 0091 }