mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Initial Mercurial commit.
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* Copyright (c) 2006-2009 LOVE Development Team
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
**/
|
||||
|
||||
#ifndef LOVE_PHYSICS_BOX2D_REVOLUTE_JOINT_H
|
||||
#define LOVE_PHYSICS_BOX2D_REVOLUTE_JOINT_H
|
||||
|
||||
// Module
|
||||
#include "Joint.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace physics
|
||||
{
|
||||
namespace box2d
|
||||
{
|
||||
/**
|
||||
* A RevoluteJoint allows two bodies relative rotation
|
||||
* around a single point.
|
||||
**/
|
||||
class RevoluteJoint : public Joint
|
||||
{
|
||||
private:
|
||||
|
||||
// The Box2D revolute joint object.
|
||||
b2RevoluteJoint * joint;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Creates a new RevoluteJoint connecting body1 and body2.
|
||||
**/
|
||||
RevoluteJoint(Body * body1, Body * body2, float x, float y);
|
||||
|
||||
virtual ~RevoluteJoint();
|
||||
|
||||
/**
|
||||
* Get the current joint angle in degrees.
|
||||
**/
|
||||
float getAngle() const;
|
||||
|
||||
/**
|
||||
* Get the current joint angle speed in degrees per second.
|
||||
**/
|
||||
float getSpeed() const;
|
||||
|
||||
/**
|
||||
* Enable/disable the joint motor.
|
||||
**/
|
||||
void setMotorEnabled(bool motor);
|
||||
|
||||
/**
|
||||
* Checks whether the motor is enabled.
|
||||
**/
|
||||
bool isMotorEnabled() const;
|
||||
|
||||
/**
|
||||
* Set the maximum motor torque, usually in N-m.
|
||||
**/
|
||||
void setMaxMotorTorque(float torque);
|
||||
|
||||
/**
|
||||
* Gets the maximum motor torque, usually in N-m.
|
||||
**/
|
||||
float getMaxMotorTorque() const;
|
||||
|
||||
/**
|
||||
* Sets the motor speed in degrees per second.
|
||||
**/
|
||||
void setMotorSpeed(float speed);
|
||||
|
||||
/**
|
||||
* Gets the motor speed in degrees per second.
|
||||
**/
|
||||
float getMotorSpeed() const;
|
||||
|
||||
/**
|
||||
* Get the current motor torque, usually in N-m.
|
||||
**/
|
||||
float getMotorTorque() const;
|
||||
|
||||
/**
|
||||
* Enable/disable the joint limit.
|
||||
**/
|
||||
void setLimitsEnabled(bool limit);
|
||||
|
||||
/**
|
||||
* Checks whether limits are enabled.
|
||||
**/
|
||||
bool isLimitsEnabled() const;
|
||||
|
||||
/**
|
||||
* Sets the upper limit in degrees.
|
||||
**/
|
||||
void setUpperLimit(float limit);
|
||||
|
||||
/**
|
||||
* Sets the lower limit in degrees.
|
||||
**/
|
||||
void setLowerLimit(float limit);
|
||||
|
||||
/**
|
||||
* Sets the limits in degrees.
|
||||
**/
|
||||
void setLimits(float lower, float upper);
|
||||
|
||||
/**
|
||||
* Gets the lower limit in degrees.
|
||||
**/
|
||||
float getLowerLimit() const;
|
||||
|
||||
/**
|
||||
* Gets the upper limit in degrees.
|
||||
**/
|
||||
float getUpperLimit() const;
|
||||
|
||||
/**
|
||||
* Gets the limits in degrees.
|
||||
* @returns The lower limit.
|
||||
* @returns The upper limit.
|
||||
**/
|
||||
int getLimits(lua_State * L);
|
||||
|
||||
};
|
||||
|
||||
} // box2d
|
||||
} // physics
|
||||
} // love
|
||||
|
||||
#endif // LOVE_PHYSICS_BOX2D_REVOLUTE_JOINT_H
|
||||
Reference in New Issue
Block a user