2 * Copyright (c) 2023 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.
18 #include <dali-physics/public-api/physics-actor.h>
21 #include <dali-physics/internal/physics-actor-impl.h>
22 #include <dali-physics/internal/physics-adaptor-impl.h>
24 namespace Dali::Toolkit::Physics
26 PhysicsActor::PhysicsActor() = default;
27 PhysicsActor::~PhysicsActor() = default;
28 PhysicsActor::PhysicsActor(const PhysicsActor& handle) = default;
29 PhysicsActor::PhysicsActor(PhysicsActor&& rhs) noexcept = default;
30 PhysicsActor& PhysicsActor::operator=(const PhysicsActor& handle) = default;
31 PhysicsActor& PhysicsActor::operator=(PhysicsActor&& handle) noexcept = default;
33 PhysicsActor PhysicsActor::New(Dali::Actor actor, Dali::Any body, PhysicsAdaptor adaptor)
35 Dali::Toolkit::Physics::Internal::PhysicsActorPtr internal = Internal::PhysicsActor::New(actor, body, GetImplementation(adaptor));
36 return PhysicsActor(internal.Get());
39 PhysicsActor PhysicsActor::DownCast(BaseHandle handle)
41 return PhysicsActor(dynamic_cast<Dali::Toolkit::Physics::Internal::PhysicsActor*>(handle.GetObjectPtr()));
44 uint32_t PhysicsActor::GetId() const
46 return GetImplementation(*this).GetId();
49 Dali::Any PhysicsActor::GetBody() const
51 return GetImplementation(*this).GetBody();
54 void PhysicsActor::AsyncSetPhysicsPosition(Dali::Vector3 actorPosition)
56 GetImplementation(*this).AsyncSetPhysicsPosition(actorPosition);
59 void PhysicsActor::AsyncSetPhysicsRotation(Dali::Quaternion actorRotation)
61 GetImplementation(*this).AsyncSetPhysicsRotation(actorRotation);
64 Dali::Vector3 PhysicsActor::GetPhysicsPosition() const
66 return GetImplementation(*this).GetPhysicsPosition();
69 Dali::Quaternion PhysicsActor::GetPhysicsRotation() const
71 return GetImplementation(*this).GetPhysicsRotation();
74 Dali::Vector3 PhysicsActor::GetActorPosition() const
76 return GetImplementation(*this).GetActorPosition();
79 Dali::Quaternion PhysicsActor::GetActorRotation() const
81 return GetImplementation(*this).GetActorRotation();
84 PhysicsActor::PhysicsActor(Internal::PhysicsActor* impl)
89 } // namespace Dali::Toolkit::Physics