box2dprismaticjoint.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Box2D QML plugin
  3. * Copyright (C) 2010 Nokia Corporation
  4. *
  5. * This file is part of the Box2D QML plugin.
  6. *
  7. * This library is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  14. * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
  15. * License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License
  18. * along with this library; If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef BOX2DPRISMATICJOINT_H
  21. #define BOX2DPRISMATICJOINT_H
  22. #include "box2djoint.h"
  23. #include <Box2D.h>
  24. class b2World;
  25. class b2PrismaticJoint;
  26. class b2PrismaticJointDef;
  27. class Box2DPrismaticJoint : public Box2DJoint
  28. {
  29. Q_OBJECT
  30. Q_PROPERTY(float lowerTranslation READ lowerTranslation WRITE setLowerTranslation NOTIFY lowerTranslationChanged)
  31. Q_PROPERTY(float upperTranslation READ upperTranslation WRITE setUpperTranslation NOTIFY upperTranslationChanged)
  32. Q_PROPERTY(float maxMotorForce READ maxMotorForce WRITE setMaxMotorForce NOTIFY maxMotorForceChanged)
  33. Q_PROPERTY(float motorSpeed READ motorSpeed WRITE setMotorSpeed NOTIFY motorSpeedChanged)
  34. Q_PROPERTY(bool enableLimit READ enableLimit WRITE setEnableLimit NOTIFY enableLimitChanged)
  35. Q_PROPERTY(bool enableMotor READ enableMotor WRITE setEnableMotor NOTIFY enableMotorChanged)
  36. Q_PROPERTY(QPointF axis READ axis WRITE setAxis NOTIFY axisChanged)
  37. public:
  38. explicit Box2DPrismaticJoint(QDeclarativeItem *parent = 0);
  39. float lowerTranslation() const;
  40. void setLowerTranslation(float lowerTranslation);
  41. float upperTranslation() const;
  42. void setUpperTranslation(float upperTranslation);
  43. float maxMotorForce() const;
  44. void setMaxMotorForce(float maxMotorForce);
  45. float motorSpeed() const;
  46. void setMotorSpeed(float motorSpeed);
  47. bool enableLimit() const;
  48. void setEnableLimit(bool enableLimit);
  49. bool enableMotor() const;
  50. void setEnableMotor(bool enableMotor);
  51. QPointF axis() const;
  52. void setAxis(const QPointF &axis);
  53. void createJoint();
  54. signals:
  55. void lowerTranslationChanged();
  56. void upperTranslationChanged();
  57. void maxMotorForceChanged();
  58. void motorSpeedChanged();
  59. void enableLimitChanged();
  60. void enableMotorChanged();
  61. void axisChanged();
  62. void localAnchorAChanged();
  63. void localAnchorBChanged();
  64. private:
  65. b2PrismaticJointDef mPrismaticJointDef;
  66. b2PrismaticJoint *mPrismaticJoint;
  67. };
  68. #endif // BOX2DPRISMATICJOINT_H