scene-loader.example fixes. 41/250641/1
authorGyörgy Straub <g.straub@partner.samsung.com>
Wed, 30 Dec 2020 16:40:53 +0000 (16:40 +0000)
committerGyörgy Straub <g.straub@partner.samsung.com>
Wed, 30 Dec 2020 16:40:53 +0000 (16:40 +0000)
- 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 <g.straub@partner.samsung.com>
examples/scene-loader/main.cpp
examples/scene-loader/scene-loader-example.cpp

index a0c8158..c87244a 100644 (file)
@@ -20,7 +20,7 @@
 \r
 using namespace Dali;\r
 \r
-int main(int argc, char** argv)\r
+int DALI_EXPORT_API main(int argc, char** argv)\r
 {\r
   auto app = Application::New(&argc, &argv, DEMO_THEME_PATH);\r
   SceneLoaderExample sceneLoader(app);\r
index 64b31a5..90df3da 100644 (file)
@@ -40,7 +40,7 @@ using namespace Dali::SceneLoader;
 namespace\r
 {\r
 \r
-const float ROTATION_SCALE = 0.05f;\r
+const float ROTATION_SCALE = 180.f; // the amount of rotation that a swipe whose length is the width of the screen, causes, in degrees.\r
 \r
 const float ITEM_HEIGHT = 50.f;\r
 \r
@@ -411,11 +411,11 @@ void SceneLoaderExample::OnPan(Actor actor, const PanGesture& pan)
   Vector2 size{ float(windowSize.GetWidth()), float(windowSize.GetHeight()) };\r
   float aspect = size.y / size.x;\r
 \r
-  size *= ROTATION_SCALE;\r
+  size /= ROTATION_SCALE;\r
 \r
   Vector2 rotation{ pan.GetDisplacement().x / size.x, pan.GetDisplacement().y / size.y * aspect };\r
 \r
-  Quaternion q = Quaternion(Radian(rotation.y), Radian(rotation.x), Radian(0.f));\r
+  Quaternion q = Quaternion(Radian(Degree(rotation.y)), Radian(Degree(rotation.x)), Radian(0.f));\r
   Quaternion q0 = mScene.GetProperty(Actor::Property::ORIENTATION).Get<Quaternion>();\r
 \r
   mScene.SetProperty(Actor::Property::ORIENTATION, q * q0);\r