2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/public-api/dynamics/dynamics-joint.h>
22 #include <dali/internal/event/actors/actor-impl.h>
24 #ifdef DYNAMICS_SUPPORT
25 #include <dali/internal/event/dynamics/dynamics-joint-impl.h>
31 DynamicsJoint::DynamicsJoint()
35 DynamicsJoint::~DynamicsJoint()
39 DynamicsJoint::DynamicsJoint(const DynamicsJoint& handle)
44 DynamicsJoint& DynamicsJoint::operator=(const DynamicsJoint& rhs)
46 BaseHandle::operator=(rhs);
50 DynamicsJoint& DynamicsJoint::operator=(BaseHandle::NullType* rhs)
52 DALI_ASSERT_ALWAYS( (rhs == NULL) && "Can only assign NULL pointer to handle");
57 void DynamicsJoint::SetLinearLimit( const int axisIndex, const float lowerLimit, const float upperLimit )
59 #ifdef DYNAMICS_SUPPORT
60 GetImplementation(*this).SetLinearLimit(axisIndex, lowerLimit, upperLimit);
64 void DynamicsJoint::SetAngularLimit( const int axisIndex, const Degree& lowerLimit, const Degree& upperLimit )
66 #ifdef DYNAMICS_SUPPORT
67 GetImplementation(*this).SetAngularLimit( axisIndex, Radian(lowerLimit), Radian(upperLimit) );
71 void DynamicsJoint::EnableSpring(const int axisIndex, const bool flag)
73 #ifdef DYNAMICS_SUPPORT
74 GetImplementation(*this).EnableSpring(axisIndex, flag);
78 void DynamicsJoint::SetSpringStiffness(const int axisIndex, const float stiffness)
80 #ifdef DYNAMICS_SUPPORT
81 GetImplementation(*this).SetSpringStiffness(axisIndex, stiffness);
85 void DynamicsJoint::SetSpringDamping(const int axisIndex, const float damping)
87 #ifdef DYNAMICS_SUPPORT
88 GetImplementation(*this).SetSpringDamping(axisIndex, damping);
92 void DynamicsJoint::SetSpringCenterPoint(const int axisIndex, const float ratio)
94 #ifdef DYNAMICS_SUPPORT
95 GetImplementation(*this).SetSpringCenterPoint(axisIndex, ratio);
99 void DynamicsJoint::EnableMotor(const int axisIndex, const bool flag)
101 #ifdef DYNAMICS_SUPPORT
102 GetImplementation(*this).EnableMotor(axisIndex, flag);
106 void DynamicsJoint::SetMotorVelocity(const int axisIndex, const float velocity)
108 #ifdef DYNAMICS_SUPPORT
109 GetImplementation(*this).SetMotorVelocity(axisIndex, velocity);
113 void DynamicsJoint::SetMotorForce(const int axisIndex, const float force)
115 #ifdef DYNAMICS_SUPPORT
116 GetImplementation(*this).SetMotorForce(axisIndex, force);
120 Actor DynamicsJoint::GetActor( const bool first ) const
122 #ifdef DYNAMICS_SUPPORT
123 Internal::ActorPtr internal( GetImplementation(*this).GetActor(first) );
125 return Actor(internal.Get());
131 DynamicsJoint::DynamicsJoint(Internal::DynamicsJoint* internal)
132 #ifdef DYNAMICS_SUPPORT
133 : BaseHandle(internal)