Commit 15b2dcc5584bbd91668948108a4241f7ca3a742a
1 parent
6167bcd2
scene-loader.example fixes.
- 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>
Showing
2 changed files
with
4 additions
and
4 deletions
examples/scene-loader/main.cpp
| @@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
| 20 | 20 | ||
| 21 | using namespace Dali; | 21 | using namespace Dali; |
| 22 | 22 | ||
| 23 | -int main(int argc, char** argv) | 23 | +int DALI_EXPORT_API main(int argc, char** argv) |
| 24 | { | 24 | { |
| 25 | auto app = Application::New(&argc, &argv, DEMO_THEME_PATH); | 25 | auto app = Application::New(&argc, &argv, DEMO_THEME_PATH); |
| 26 | SceneLoaderExample sceneLoader(app); | 26 | SceneLoaderExample sceneLoader(app); |
examples/scene-loader/scene-loader-example.cpp
| @@ -40,7 +40,7 @@ using namespace Dali::SceneLoader; | @@ -40,7 +40,7 @@ using namespace Dali::SceneLoader; | ||
| 40 | namespace | 40 | namespace |
| 41 | { | 41 | { |
| 42 | 42 | ||
| 43 | -const float ROTATION_SCALE = 0.05f; | 43 | +const float ROTATION_SCALE = 180.f; // the amount of rotation that a swipe whose length is the width of the screen, causes, in degrees. |
| 44 | 44 | ||
| 45 | const float ITEM_HEIGHT = 50.f; | 45 | const float ITEM_HEIGHT = 50.f; |
| 46 | 46 | ||
| @@ -411,11 +411,11 @@ void SceneLoaderExample::OnPan(Actor actor, const PanGesture& pan) | @@ -411,11 +411,11 @@ void SceneLoaderExample::OnPan(Actor actor, const PanGesture& pan) | ||
| 411 | Vector2 size{ float(windowSize.GetWidth()), float(windowSize.GetHeight()) }; | 411 | Vector2 size{ float(windowSize.GetWidth()), float(windowSize.GetHeight()) }; |
| 412 | float aspect = size.y / size.x; | 412 | float aspect = size.y / size.x; |
| 413 | 413 | ||
| 414 | - size *= ROTATION_SCALE; | 414 | + size /= ROTATION_SCALE; |
| 415 | 415 | ||
| 416 | Vector2 rotation{ pan.GetDisplacement().x / size.x, pan.GetDisplacement().y / size.y * aspect }; | 416 | Vector2 rotation{ pan.GetDisplacement().x / size.x, pan.GetDisplacement().y / size.y * aspect }; |
| 417 | 417 | ||
| 418 | - Quaternion q = Quaternion(Radian(rotation.y), Radian(rotation.x), Radian(0.f)); | 418 | + Quaternion q = Quaternion(Radian(Degree(rotation.y)), Radian(Degree(rotation.x)), Radian(0.f)); |
| 419 | Quaternion q0 = mScene.GetProperty(Actor::Property::ORIENTATION).Get<Quaternion>(); | 419 | Quaternion q0 = mScene.GetProperty(Actor::Property::ORIENTATION).Get<Quaternion>(); |
| 420 | 420 | ||
| 421 | mScene.SetProperty(Actor::Property::ORIENTATION, q * q0); | 421 | mScene.SetProperty(Actor::Property::ORIENTATION, q * q0); |