From 15b2dcc5584bbd91668948108a4241f7ca3a742a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gy=C3=B6rgy=20Straub?= Date: Wed, 30 Dec 2020 16:40:53 +0000 Subject: [PATCH] scene-loader.example fixes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - main() is exported using DALI_EXPORT_API, so that Android may see it; - refined rotation code and made the scaling factor a more meaningful quantity; Change-Id: I1c61f27a2bd7ce402eac34df8b393269371ca61d Signed-off-by: György Straub --- examples/scene-loader/main.cpp | 2 +- examples/scene-loader/scene-loader-example.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/scene-loader/main.cpp b/examples/scene-loader/main.cpp index a0c81585..c87244a6 100644 --- a/examples/scene-loader/main.cpp +++ b/examples/scene-loader/main.cpp @@ -20,7 +20,7 @@ using namespace Dali; -int main(int argc, char** argv) +int DALI_EXPORT_API main(int argc, char** argv) { auto app = Application::New(&argc, &argv, DEMO_THEME_PATH); SceneLoaderExample sceneLoader(app); diff --git a/examples/scene-loader/scene-loader-example.cpp b/examples/scene-loader/scene-loader-example.cpp index 64b31a5e..90df3dae 100644 --- a/examples/scene-loader/scene-loader-example.cpp +++ b/examples/scene-loader/scene-loader-example.cpp @@ -40,7 +40,7 @@ using namespace Dali::SceneLoader; namespace { -const float ROTATION_SCALE = 0.05f; +const float ROTATION_SCALE = 180.f; // the amount of rotation that a swipe whose length is the width of the screen, causes, in degrees. const float ITEM_HEIGHT = 50.f; @@ -411,11 +411,11 @@ void SceneLoaderExample::OnPan(Actor actor, const PanGesture& pan) Vector2 size{ float(windowSize.GetWidth()), float(windowSize.GetHeight()) }; float aspect = size.y / size.x; - size *= ROTATION_SCALE; + size /= ROTATION_SCALE; Vector2 rotation{ pan.GetDisplacement().x / size.x, pan.GetDisplacement().y / size.y * aspect }; - Quaternion q = Quaternion(Radian(rotation.y), Radian(rotation.x), Radian(0.f)); + Quaternion q = Quaternion(Radian(Degree(rotation.y)), Radian(Degree(rotation.x)), Radian(0.f)); Quaternion q0 = mScene.GetProperty(Actor::Property::ORIENTATION).Get(); mScene.SetProperty(Actor::Property::ORIENTATION, q * q0); -- 2.34.1