Interface for Joint classes. More...
#include <Joint.h>
Public Types | |
using | Ptr = std::unique_ptr< Joint > |
Unique joint pointer. More... | |
Public Member Functions | |
std::string | getClassType () const override |
Get the name of this class. More... | |
virtual JointType | getType () const =0 |
Get the type of the joint. More... | |
virtual RigidBody * | getBodyA ()=0 |
Get the first body attached to ths joint. More... | |
virtual const RigidBody * | getBodyA () const =0 |
virtual RigidBody * | getBodyB ()=0 |
Get the second body attached to this joint. More... | |
virtual const RigidBody * | getBodyB () const =0 |
virtual Vector2f | getBodyAWorldAnchorPoint () const =0 |
Get the anchor point on body A in world coordinates. More... | |
virtual Vector2f | getBodyBWorldAnchorPoint () const =0 |
Get the anchor point on body B in world coordinates. More... | |
virtual Vector2f | getReactionForce (float fpsLimit) const =0 |
Get the reaction force on body B at the joint anchor. More... | |
virtual float | getReactionTorque (float fpsLimit) const =0 |
Get the reaction torque on body B. More... | |
virtual PropertyContainer & | getUserData ()=0 |
Get the application specific Joint data. More... | |
virtual const PropertyContainer & | getUserData () const =0 |
virtual bool | canBodiesCollide () const =0 |
Check if the joint bodies can collide with each other or not. More... | |
virtual b2Joint * | getInternalJoint ()=0 |
virtual const b2Joint * | getInternalJoint () const =0 |
void | setTag (const std::string &tag) |
Assign the object an alias. More... | |
const std::string & | getTag () const |
Get the tag assigned to the object. More... | |
unsigned int | getObjectId () const |
Get the unique id of the object. More... | |
virtual std::string | getClassName () const =0 |
Get the name of the objects concrete class. More... | |
int | onPropertyChange (const std::string &property, const Callback< Property > &callback, bool oneTime=false) |
Add an event listener to a specific property change event. More... | |
int | onPropertyChange (const Callback< Property > &callback, bool oneTime=false) |
Add an event listener to any property change event. More... | |
void | suspendedEventListener (int id, bool suspend) |
Pause or resume execution of an event listener. More... | |
bool | isEventListenerSuspended (int id) const |
Check if an event listener is suspended or not. More... | |
bool | removeEventListener (const std::string &event, int id) |
Remove an event listener from an event. More... | |
bool | removeEventListener (int id) |
Remove an event listener. More... | |
int | onDestruction (const Callback<> &callback) |
Add a destruction listener. More... | |
bool | isSameObjectAs (const Object &other) const |
Check if another object is the same instance as this object. More... | |
Protected Member Functions | |
void | emitChange (const Property &property) |
Dispatch a property change event. More... | |
void | emitDestruction () |
Emit a destruction event. More... | |
Protected Attributes | |
EventEmitter | eventEmitter_ |
Event dispatcher. More... | |
Interface for Joint classes.
Joints are used to constrain rigid bodies to the world or to each other e.g a pulley
Note that joints are not constructed directly, use ime::PhysicsEngine::createJoint
using ime::Joint::Ptr = std::unique_ptr<Joint> |
|
pure virtual |
Check if the joint bodies can collide with each other or not.
Implemented in ime::DistanceJoint.
|
protectedinherited |
Dispatch a property change event.
property | The property that changed |
This function will invoke all the event listeners of the specified property
|
protectedinherited |
Emit a destruction event.
|
pure virtual |
Get the first body attached to ths joint.
Implemented in ime::DistanceJoint.
|
pure virtual |
Get the anchor point on body A in world coordinates.
Implemented in ime::DistanceJoint.
|
pure virtual |
Get the second body attached to this joint.
Implemented in ime::DistanceJoint.
|
pure virtual |
Get the anchor point on body B in world coordinates.
Implemented in ime::DistanceJoint.
|
pure virtualinherited |
Get the name of the objects concrete class.
This function is implemented by all internal classes that inherit from this class (either directly or indirectly). Example:
Implemented in ime::audio::Music, ime::audio::SoundEffect, ime::GameObject, ime::GridObject, ime::CyclicGridMover, ime::GridMover, ime::KeyboardGridMover, ime::RandomGridMover, ime::TargetGridMover, ime::AABB, ime::BoxCollider, ime::CircleCollider, ime::EdgeCollider, ime::PolygonCollider, ime::DistanceJoint, ime::RigidBody, ime::RenderLayer, ime::RenderLayerContainer, ime::Scene, ime::Camera, ime::CircleShape, ime::ConvexShape, ime::RectangleShape, ime::Sprite, ime::SpriteSheet, and ime::Tile.
|
overridevirtual |
Get the name of this class.
Note that this function is only implemented by child classes of Object which also serve as a base class for other classes
Reimplemented from ime::Object.
|
inherited |
Get the unique id of the object.
Note that each instance of ime::Object has a unique id
|
pure virtual |
Get the reaction force on body B at the joint anchor.
fpsLimit | The games Frames Per Second limit |
Implemented in ime::DistanceJoint.
|
pure virtual |
Get the reaction torque on body B.
fpsLimit | The games Frames Per Second limit |
Implemented in ime::DistanceJoint.
|
inherited |
|
pure virtual |
|
pure virtual |
Get the application specific Joint data.
This data is extracted from the JointDefinition
Implemented in ime::DistanceJoint.
|
inherited |
Check if an event listener is suspended or not.
id | The identification number of the listener to be checked |
This function also returns false if the specified event listener does not exist
|
inherited |
Check if another object is the same instance as this object.
other | The object to compare against this object |
|
inherited |
Add a destruction listener.
callback | Function to be executed when the object is destroyed |
The destruction listener is called when the object reaches the end of its lifetime. Note that an object may have multiple destruction listeners registered to it
|
inherited |
Add an event listener to any property change event.
callback | The function to be executed when any property changes |
oneTime | True to execute the callback one-time or false to execute it every time the event is triggered |
When unsubscribing the any property change event handler, you must pass "propertyChange" as the name of the event
|
inherited |
Add an event listener to a specific property change event.
property | The name of the property to add an event listener to |
oneTime | True to execute the callback one-time or false to execute it every time the event is triggered |
callback | The function to be executed when the property changes |
A property change event is triggered by any function that begins with set, where the the text after set is the name of the property. For example, the setTag() function, modifies the tag property of the object, thus will generate a "tag" change event each time it is called
Note that multiple event listeners may be registered to the same property change event. In addition, when adding a property change event listener, the name of the property must be in lowercase.
|
inherited |
Remove an event listener from an event.
event | The name of the event to remove an event listener from |
id | The unique id of the event listener to be removed |
|
inherited |
Remove an event listener.
id | The id of the event listener to be removed |
|
inherited |
Assign the object an alias.
tag | The alias of the object |
This function is useful if you want to refer to the object by a tag instead of its object id. Unlike an object id, multiple objects may have the same tag
By default, the tag is an empty string
|
inherited |
Pause or resume execution of an event listener.
id | The event listeners unique identification number |
suspend | True to suspend/pause or false to unsuspend/resume |
|
protectedinherited |