Commit e74b8b44afcf8bb20a7fe3da25ececb0e01e7469

Authored by Xiangyin Ma
2 parents be88883a bf96ef03

[dali_1.2.5] Merge branch 'devel/master'

Change-Id: I124203ec4115d626695b7b11212eed346c3eaf2b
com.samsung.dali-demo.xml
... ... @@ -55,9 +55,6 @@
55 55 <ui-application appid="motion-stretch.example" exec="/usr/apps/com.samsung.dali-demo/bin/motion-stretch.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
56 56 <label>Motion Stretch</label>
57 57 </ui-application>
58   - <ui-application appid="radial-menu.example" exec="/usr/apps/com.samsung.dali-demo/bin/radial-menu.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
59   - <label>Radial Menu</label>
60   - </ui-application>
61 58 <ui-application appid="refraction-effect.example" exec="/usr/apps/com.samsung.dali-demo/bin/refraction-effect.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
62 59 <label>Refraction effect</label>
63 60 </ui-application>
... ... @@ -172,4 +169,7 @@
172 169 <ui-application appid="styling.example" exec="/usr/apps/com.samsung.dali-demo/bin/styling.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
173 170 <label>Styling</label>
174 171 </ui-application>
  172 + <ui-application appid="progress-bar.example" exec="/usr/apps/com.samsung.dali-demo/bin/progress-bar.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
  173 + <label>Progress Bar</label>
  174 + </ui-application>
175 175 </manifest>
... ...
demo/dali-demo.cpp
1 1 /*
2   - * Copyright (c) 2014 Samsung Electronics Co., Ltd.
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3 3 *
4 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 5 * you may not use this file except in compliance with the License.
... ... @@ -46,7 +46,6 @@ int DALI_EXPORT_API main(int argc, char **argv)
46 46 demo.AddExample(Example("motion-blur.example", DALI_DEMO_STR_TITLE_MOTION_BLUR));
47 47 demo.AddExample(Example("motion-stretch.example", DALI_DEMO_STR_TITLE_MOTION_STRETCH));
48 48 demo.AddExample(Example("page-turn-view.example", DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW));
49   - demo.AddExample(Example("radial-menu.example", DALI_DEMO_STR_TITLE_RADIAL_MENU));
50 49 demo.AddExample(Example("refraction-effect.example", DALI_DEMO_STR_TITLE_REFRACTION));
51 50 demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW));
52 51 demo.AddExample(Example("shadow-bone-lighting.example", DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS));
... ... @@ -81,6 +80,8 @@ int DALI_EXPORT_API main(int argc, char **argv)
81 80 demo.AddExample(Example("mesh-visual.example", DALI_DEMO_STR_TITLE_MESH_VISUAL));
82 81 demo.AddExample(Example("primitive-shapes.example", DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES));
83 82 demo.AddExample(Example("styling.example", DALI_DEMO_STR_TITLE_STYLING));
  83 + demo.AddExample(Example("sparkle.example", DALI_DEMO_STR_TITLE_SPARKLE));
  84 + demo.AddExample(Example("progress-bar.example", DALI_DEMO_STR_TITLE_PROGRESS_BAR));
84 85  
85 86 demo.SortAlphabetically( true );
86 87  
... ...
examples/mesh-visual/mesh-visual-example.cpp
... ... @@ -95,25 +95,19 @@ public:
95 95 Stage stage = Stage::GetCurrent();
96 96 stage.SetBackgroundColor( Vector4( 0.0, 0.5, 1.0, 1.0 ) );
97 97  
98   - //Set up layer to place objects on.
99   - Layer baseLayer = Layer::New();
100   - baseLayer.SetParentOrigin( ParentOrigin::CENTER );
101   - baseLayer.SetAnchorPoint( AnchorPoint::CENTER );
102   - baseLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
103   - baseLayer.SetBehavior( Layer::LAYER_2D ); //We use a 2D layer as this is closer to UI work than full 3D scene creation.
104   - baseLayer.SetDepthTestDisabled( false ); //Enable depth testing, as otherwise the 2D layer would not do so.
105   - baseLayer.RegisterProperty( "Tag", LAYER_TAG ); //Used to differentiate between different kinds of actor.
106   - baseLayer.TouchedSignal().Connect( this, &MeshVisualController::OnTouch );
107   - stage.Add( baseLayer );
  98 + //Set up root layer to receive touch gestures.
  99 + Layer rootLayer = stage.GetRootLayer();
  100 + rootLayer.RegisterProperty( "Tag", LAYER_TAG ); //Used to differentiate between different kinds of actor.
  101 + rootLayer.TouchSignal().Connect( this, &MeshVisualController::OnTouch );
108 102  
109 103 //Place models on the scene.
110   - SetupModels( baseLayer );
  104 + SetupModels( rootLayer );
111 105  
112 106 //Place buttons on the scene.
113   - SetupButtons( baseLayer );
  107 + SetupButtons( rootLayer );
114 108  
115 109 //Add a light to the scene.
116   - SetupLight( baseLayer );
  110 + SetupLight( rootLayer );
117 111  
118 112 //Allow for exiting of the application via key presses.
119 113 stage.KeyEventSignal().Connect( this, &MeshVisualController::OnKeyEvent );
... ... @@ -129,7 +123,7 @@ public:
129 123 mContainers[i].SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS );
130 124 mContainers[i].RegisterProperty( "Tag", MODEL_TAG ); //Used to differentiate between different kinds of actor.
131 125 mContainers[i].RegisterProperty( "Model", Property::Value( i ) ); //Used to index into the model.
132   - mContainers[i].TouchedSignal().Connect( this, &MeshVisualController::OnTouch );
  126 + mContainers[i].TouchSignal().Connect( this, &MeshVisualController::OnTouch );
133 127 layer.Add( mContainers[i] );
134 128 }
135 129  
... ... @@ -284,7 +278,7 @@ public:
284 278 SetLightImage();
285 279  
286 280 //Connect to touch signal for dragging.
287   - mLightSource.TouchedSignal().Connect( this, &MeshVisualController::OnTouch );
  281 + mLightSource.TouchSignal().Connect( this, &MeshVisualController::OnTouch );
288 282  
289 283 //Place the light source on a layer above the base, so that it is rendered above everything else.
290 284 Layer upperLayer = Layer::New();
... ... @@ -396,14 +390,11 @@ public:
396 390  
397 391 //If the light source is touched, move it by dragging it.
398 392 //If a model is touched, rotate it by panning around.
399   - bool OnTouch( Actor actor, const TouchEvent& event )
  393 + bool OnTouch( Actor actor, const TouchData& touch )
400 394 {
401   - //Get primary touch point.
402   - const Dali::TouchPoint& point = event.GetPoint( 0 );
403   -
404   - switch( point.state )
  395 + switch( touch.GetState( 0 ) )
405 396 {
406   - case TouchPoint::Down:
  397 + case PointState::DOWN:
407 398 {
408 399 //Determine what was touched.
409 400 actor.GetProperty( actor.GetPropertyIndex( "Tag" ) ).Get( mTag );
... ... @@ -417,13 +408,13 @@ public:
417 408 mModels[mSelectedModelIndex].rotationAnimation.Pause();
418 409  
419 410 //Store start points.
420   - mPanStart = point.screen;
  411 + mPanStart = touch.GetScreenPosition( 0 );
421 412 mRotationStart = mModels[mSelectedModelIndex].rotation;
422 413 }
423 414  
424 415 break;
425 416 }
426   - case TouchPoint::Motion:
  417 + case PointState::MOTION:
427 418 {
428 419 //Switch on the kind of actor we're interacting with.
429 420 switch( mTag )
... ... @@ -431,7 +422,7 @@ public:
431 422 case MODEL_TAG: //Rotate model
432 423 {
433 424 //Calculate displacement and corresponding rotation.
434   - Vector2 displacement = point.screen - mPanStart;
  425 + Vector2 displacement = touch.GetScreenPosition( 0 ) - mPanStart;
435 426 mModels[mSelectedModelIndex].rotation = Vector2( mRotationStart.x - displacement.y / Y_ROTATION_DISPLACEMENT_FACTOR, // Y displacement rotates around X axis
436 427 mRotationStart.y + displacement.x / X_ROTATION_DISPLACEMENT_FACTOR ); // X displacement rotates around Y axis
437 428 Quaternion rotation = Quaternion( Radian( mModels[mSelectedModelIndex].rotation.x ), Vector3::XAXIS) *
... ... @@ -445,7 +436,7 @@ public:
445 436 case LIGHT_TAG: //Drag light
446 437 {
447 438 //Set light source to new position and update the models accordingly.
448   - mLightSource.SetPosition( Vector3( point.screen ) );
  439 + mLightSource.SetPosition( Vector3( touch.GetScreenPosition( 0 ) ) );
449 440 UpdateLight();
450 441  
451 442 break;
... ... @@ -454,8 +445,8 @@ public:
454 445  
455 446 break;
456 447 }
457   - case TouchPoint::Interrupted: //Same as finished.
458   - case TouchPoint::Finished:
  448 + case PointState::INTERRUPTED: //Same as finished.
  449 + case PointState::FINISHED:
459 450 {
460 451 if( mTag == MODEL_TAG )
461 452 {
... ...
examples/model3d-view/model3d-view-example.cpp
... ... @@ -76,18 +76,10 @@ public:
76 76 Vector2 screenSize = stage.GetSize();
77 77  
78 78 //Add background
79   - Toolkit::ImageView backView = Toolkit::ImageView::New(BACKGROUND_IMAGE);
80   - backView.SetAnchorPoint( AnchorPoint::TOP_LEFT );
81   - stage.Add(backView);
82   -
83   - //Add 3D model control
84   - m3DLayer = Layer::New();
85   - stage.GetRootLayer().Add(m3DLayer);
86   -
87   - //3D models require 3D based rendering method, so it can use depth buffer, etc.
88   - m3DLayer.SetBehavior(Layer::LAYER_3D);
89   - m3DLayer.SetParentOrigin( ParentOrigin::CENTER );
90   - m3DLayer.SetAnchorPoint( AnchorPoint::CENTER );
  79 + Toolkit::ImageView backView = Toolkit::ImageView::New( BACKGROUND_IMAGE );
  80 + backView.SetParentOrigin( ParentOrigin::CENTER );
  81 + backView.SetAnchorPoint( AnchorPoint::CENTER );
  82 + stage.Add( backView );
91 83  
92 84 mModelCounter = 0;
93 85  
... ... @@ -100,7 +92,7 @@ public:
100 92  
101 93 mModel3dView.SetProperty(Model3dView::Property::LIGHT_POSITION, Vector3(5,10.,0));
102 94  
103   - m3DLayer.Add( mModel3dView );
  95 + backView.Add( mModel3dView );
104 96  
105 97 mIlluminationShader = Model3dView::IlluminationType(mModel3dView.GetProperty<int>(Model3dView::Property::ILLUMINATION_TYPE));
106 98  
... ... @@ -108,7 +100,7 @@ public:
108 100 mButtonLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
109 101 mButtonLayer.SetParentOrigin( ParentOrigin::CENTER );
110 102 mButtonLayer.SetAnchorPoint( AnchorPoint::CENTER );
111   - stage.GetRootLayer().Add(mButtonLayer);
  103 + stage.Add(mButtonLayer);
112 104  
113 105 // Create button for model changing
114 106 Toolkit::PushButton editButton = Toolkit::PushButton::New();
... ... @@ -281,7 +273,6 @@ private:
281 273 int mModelCounter;
282 274 Model3dView mModel3dView;
283 275  
284   - Layer m3DLayer;
285 276 Layer mButtonLayer;
286 277 TapGestureDetector mTapDetector;
287 278  
... ...
examples/progress-bar/progress-bar-example.cpp 0 → 100644
  1 +/*
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  3 + *
  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
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  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.
  15 + *
  16 + */
  17 +
  18 +#include "shared/view.h"
  19 +#include <dali-toolkit/dali-toolkit.h>
  20 +#include <dali-toolkit/devel-api/controls/progress-bar/progress-bar.h>
  21 +
  22 +using namespace Dali;
  23 +using namespace Dali::Toolkit;
  24 +using Dali::Toolkit::ProgressBar;
  25 +
  26 +namespace
  27 +{
  28 +
  29 +const char* const BACKGROUND_IMAGE = DEMO_IMAGE_DIR "background-gradient.jpg";
  30 +const char* const TOOLBAR_IMAGE = DEMO_IMAGE_DIR "top-bar.png";
  31 +const char* const TOOLBAR_TITLE = "Progress Bar";
  32 +
  33 +const Vector4 BACKGROUND_COLOUR( 1.0f, 1.0f, 1.0f, 0.15f );
  34 +
  35 +// Layout sizes
  36 +const int MARGIN_SIZE = 10;
  37 +const int TOP_MARGIN = 85;
  38 +
  39 +} // namespace
  40 +
  41 +/** This example shows how to create and use PROGRESS BAR.
  42 + */
  43 +
  44 +class ProgressBarExample: public ConnectionTracker
  45 +{
  46 +public:
  47 +
  48 + ProgressBarExample( Application& application )
  49 + : mApplication( application )
  50 + {
  51 + // Connect to the Application's Init signal
  52 + mProgressValue = 0.0f;
  53 + mApplication.InitSignal().Connect( this, &ProgressBarExample::Create );
  54 + }
  55 +
  56 + ~ProgressBarExample()
  57 + {
  58 + // Nothing to do here
  59 + }
  60 +
  61 + void Create( Application& application )
  62 + {
  63 + // The Init signal is received once (only) during the Application lifetime
  64 +
  65 + // Respond to key events
  66 + Stage::GetCurrent().KeyEventSignal().Connect( this, &ProgressBarExample::OnKeyEvent );
  67 +
  68 + // Creates a default view with a default tool bar.
  69 + // The view is added to the stage.
  70 +
  71 + mContentLayer = DemoHelper::CreateView( application,
  72 + mView,
  73 + mToolBar,
  74 + BACKGROUND_IMAGE,
  75 + TOOLBAR_IMAGE,
  76 + TOOLBAR_TITLE );
  77 +
  78 + mProgressBar = ProgressBar::New();
  79 + mProgressBar.SetParentOrigin(ParentOrigin::TOP_CENTER);
  80 + mProgressBar.SetAnchorPoint(AnchorPoint::TOP_CENTER);
  81 + mProgressBar.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
  82 + mProgressBar.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
  83 +
  84 + Toolkit::TableView contentTable = Toolkit::TableView::New(2, 1);
  85 + contentTable.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH);
  86 + contentTable.SetResizePolicy(ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT);
  87 + contentTable.SetAnchorPoint(AnchorPoint::TOP_LEFT);
  88 + contentTable.SetParentOrigin(ParentOrigin::TOP_LEFT);
  89 + contentTable.SetCellPadding(Size(MARGIN_SIZE, MARGIN_SIZE * 0.5f));
  90 +
  91 + for( unsigned int i = 0; i < contentTable.GetRows(); ++i )
  92 + {
  93 + contentTable.SetFitHeight( i );
  94 + }
  95 +
  96 + contentTable.SetPosition( 0.0f, TOP_MARGIN );
  97 + mContentLayer.Add( contentTable );
  98 +
  99 + // Image selector for progress bar
  100 + Toolkit::TableView progressBackground = Toolkit::TableView::New( 1, 1 );
  101 + progressBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  102 + progressBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  103 + progressBackground.SetBackgroundColor( BACKGROUND_COLOUR );
  104 + progressBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) );
  105 + progressBackground.SetRelativeWidth( 0, 1.0f );
  106 + progressBackground.SetFitHeight( 0 );
  107 + contentTable.Add( progressBackground );
  108 + progressBackground.Add( mProgressBar );
  109 +
  110 + // Create buttons
  111 + Toolkit::TableView buttonBackground = Toolkit::TableView::New( 2, 1 );
  112 + buttonBackground.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  113 + buttonBackground.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  114 + buttonBackground.SetBackgroundColor( BACKGROUND_COLOUR );
  115 + buttonBackground.SetCellPadding( Size( MARGIN_SIZE, MARGIN_SIZE ) );
  116 +
  117 + for( unsigned int i = 0; i < buttonBackground.GetRows(); ++i )
  118 + {
  119 + buttonBackground.SetFitHeight( i );
  120 + }
  121 +
  122 + contentTable.Add( buttonBackground );
  123 +
  124 + mSetProgressButton = Toolkit::PushButton::New();
  125 + mSetProgressButton.SetLabelText( "Set Progress" );
  126 + mSetProgressButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  127 + mSetProgressButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  128 + mSetProgressButton.ClickedSignal().Connect( this, &ProgressBarExample::OnSetProgressButtonSelected );
  129 +
  130 + buttonBackground.Add( mSetProgressButton );
  131 +
  132 + mResetProgressButton = Toolkit::PushButton::New();
  133 + mResetProgressButton.SetLabelText( "Reset Progress" );
  134 + mResetProgressButton.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
  135 + mResetProgressButton.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::HEIGHT );
  136 + mResetProgressButton.ClickedSignal().Connect( this, &ProgressBarExample::OnResetProgressButtonSelected );
  137 +
  138 + buttonBackground.Add( mResetProgressButton );
  139 + }
  140 +
  141 + bool OnResetProgressButtonSelected( Toolkit::Button button )
  142 + {
  143 + mProgressValue = 0.0f;
  144 + mProgressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, 0.0f);
  145 + return true;
  146 + }
  147 +
  148 + bool OnSetProgressButtonSelected( Toolkit::Button button )
  149 + {
  150 + mProgressValue += 0.1f;
  151 + mProgressBar.SetProperty(ProgressBar::Property::PROGRESS_VALUE, mProgressValue);
  152 + return true;
  153 + }
  154 +
  155 + void OnKeyEvent( const KeyEvent& event )
  156 + {
  157 + if( event.state == KeyEvent::Down )
  158 + {
  159 + if( IsKey( event, Dali::DALI_KEY_ESCAPE ) || IsKey( event, Dali::DALI_KEY_BACK ) )
  160 + {
  161 + // Exit application when click back or escape.
  162 + mApplication.Quit();
  163 + }
  164 + }
  165 + }
  166 +
  167 +private:
  168 +
  169 + Application& mApplication;
  170 + Toolkit::Control mView; ///< The View instance.
  171 + Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
  172 + Layer mContentLayer; ///< Content layer.
  173 + ProgressBar mProgressBar;
  174 + Toolkit::PushButton mSetProgressButton;
  175 + Toolkit::PushButton mResetProgressButton;
  176 + float mProgressValue;
  177 +};
  178 +
  179 +void RunTest( Application& application )
  180 +{
  181 + ProgressBarExample test( application );
  182 + application.MainLoop();
  183 +}
  184 +
  185 +// Entry point for Linux & Tizen applications
  186 +int DALI_EXPORT_API main( int argc, char **argv )
  187 +{
  188 + Application application = Application::New( &argc, &argv, DEMO_THEME_PATH );
  189 +
  190 + RunTest( application );
  191 +
  192 + return 0;
  193 +}
... ...
examples/radial-menu/radial-menu-example.cpp deleted
1   -/*
2   - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3   - *
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
7   - *
8   - * http://www.apache.org/licenses/LICENSE-2.0
9   - *
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.
15   - *
16   - */
17   -
18   -#include <dali/dali.h>
19   -#include <dali-toolkit/dali-toolkit.h>
20   -#include "shared/view.h"
21   -#include "radial-sweep-view.h"
22   -#include "radial-sweep-view-impl.h"
23   -
24   -using namespace Dali;
25   -using namespace Dali::Toolkit;
26   -
27   -namespace
28   -{
29   -const char* TEST_OUTER_RING_FILENAME = DEMO_IMAGE_DIR "layer2.png"; // Image to be masked
30   -const char* TEST_INNER_RING_FILENAME = DEMO_IMAGE_DIR "layer1.png"; // Image to be masked
31   -const char* TEST_MENU_FILENAME = DEMO_IMAGE_DIR "layer3.png"; // Image to be masked
32   -const char* TEST_DIAL_FILENAME = DEMO_IMAGE_DIR "layer4.png"; // Image to be masked
33   -const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); // Background for toolbar
34   -const char* APPLICATION_TITLE( "Radial Menu" );
35   -const char * const PLAY_ICON( DEMO_IMAGE_DIR "icon-play.png" );
36   -const char * const PLAY_ICON_SELECTED( DEMO_IMAGE_DIR "icon-play-selected.png" );
37   -const char * const STOP_ICON( DEMO_IMAGE_DIR "icon-stop.png" );
38   -const char * const STOP_ICON_SELECTED( DEMO_IMAGE_DIR "icon-stop-selected.png" );
39   -}
40   -
41   -
42   -/********************************************************************************
43   - * Application controller class
44   - */
45   -
46   -// This example shows how to create a mesh actor for use as a stencil buffer
47   -class RadialMenuExample : public ConnectionTracker
48   -{
49   -public:
50   - /**
51   - * Constructor
52   - * @param[in] app The application handle
53   - */
54   - RadialMenuExample(Application app);
55   -
56   - /**
57   - * Destructor
58   - */
59   - ~RadialMenuExample();
60   -
61   -private:
62   -
63   - /**
64   - * Initialization signal handler - all actor initialization should happen here
65   - * @param[in] app The application handle
66   - */
67   - void OnInit(Application& app);
68   -
69   - /**
70   - * Create a sweep view with the given image and parameters
71   - */
72   - RadialSweepView CreateSweepView( std::string imageName, Degree initial, Degree final );
73   -
74   - /**
75   - * Start the sweep animation on the menu
76   - */
77   - void StartAnimation();
78   -
79   - /**
80   - * Play or pause the animation when the button is clicked
81   - */
82   - bool OnButtonClicked( Toolkit::Button button );
83   -
84   - /**
85   - * Update the state flag and change the button icon when the animation is finished
86   - */
87   - void OnAnimationFinished( Animation& source );
88   -
89   - /**
90   - * Main key event handler
91   - *
92   - * @param[in] event The key event to respond to
93   - */
94   - void OnKeyEvent(const KeyEvent& event);
95   -
96   -private: // Member variables
97   - enum AnimState
98   - {
99   - STOPPED,
100   - PAUSED,
101   - PLAYING
102   - };
103   -
104   - Application mApplication; ///< The application handle
105   - Toolkit::Control mView; ///< The toolbar view
106   - Layer mContents; ///< The toolbar contents pane
107   - ImageView mImageView; ///< Image view shown by stencil mask
108   - Animation mAnimation;
109   - AnimState mAnimationState;
110   -
111   - Toolkit::PushButton mPlayStopButton;
112   - ImageView mDialView;
113   - RadialSweepView mRadialSweepView1;
114   - RadialSweepView mRadialSweepView2;
115   - RadialSweepView mRadialSweepView3;
116   -};
117   -
118   -RadialMenuExample::RadialMenuExample(Application app)
119   -: mApplication( app ),
120   - mAnimationState(STOPPED)
121   -{
122   - // Connect to the Application's Init signal
123   - app.InitSignal().Connect(this, &RadialMenuExample::OnInit);
124   -}
125   -
126   -RadialMenuExample::~RadialMenuExample()
127   -{
128   - // Nothing to do here; actor handles will clean up themselves.
129   -}
130   -
131   -void RadialMenuExample::OnInit(Application& app)
132   -{
133   - Stage stage = Dali::Stage::GetCurrent();
134   -
135   - // The Init signal is received once (only) during the Application lifetime
136   - stage.KeyEventSignal().Connect(this, &RadialMenuExample::OnKeyEvent);
137   -
138   - // Create toolbar & view
139   - Toolkit::ToolBar toolBar;
140   - mContents = DemoHelper::CreateView( mApplication,
141   - mView,
142   - toolBar,
143   - "",
144   - TOOLBAR_IMAGE,
145   - APPLICATION_TITLE );
146   -
147   - mPlayStopButton = Toolkit::PushButton::New();
148   - mPlayStopButton.SetUnselectedImage( STOP_ICON );
149   - mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED );
150   -
151   - mPlayStopButton.ClickedSignal().Connect( this, &RadialMenuExample::OnButtonClicked );
152   -
153   - toolBar.AddControl( mPlayStopButton,
154   - DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
155   - Toolkit::Alignment::HorizontalRight,
156   - DemoHelper::DEFAULT_PLAY_PADDING );
157   -
158   -
159   - const ImageDimensions intImgSize = ResourceImage::GetImageSize(TEST_OUTER_RING_FILENAME);
160   - Vector2 imgSize = Vector2( intImgSize.GetWidth(), intImgSize.GetHeight() );
161   - Vector2 stageSize = stage.GetSize();
162   - float scale = stageSize.width / imgSize.width;
163   - float availableHeight = stageSize.height - DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight * 2.0f;
164   - if(availableHeight <= stageSize.width)
165   - {
166   - scale = availableHeight / imgSize.width;
167   - }
168   -
169   - mRadialSweepView1 = CreateSweepView( TEST_OUTER_RING_FILENAME, Degree(-90.0f), Degree(-90.0f));
170   - mRadialSweepView2 = CreateSweepView( TEST_INNER_RING_FILENAME, Degree(90.0f), Degree(0.0f));
171   - mRadialSweepView3 = CreateSweepView( TEST_MENU_FILENAME, Degree(100.0f), Degree(0.0f));
172   - mRadialSweepView3.SetInitialActorAngle(Degree(-110));
173   - mRadialSweepView3.SetFinalActorAngle(Degree(0));
174   -
175   - mDialView = ImageView::New( TEST_DIAL_FILENAME );
176   - mDialView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
177   - mDialView.SetParentOrigin( ParentOrigin::CENTER );
178   - mDialView.SetScale(scale);
179   - Layer dialLayer = Layer::New();
180   -
181   - dialLayer.Add( mDialView );
182   - dialLayer.SetParentOrigin( ParentOrigin::CENTER );
183   - dialLayer.SetSize(stage.GetSize());
184   - mContents.Add(dialLayer);
185   -
186   - mRadialSweepView1.SetScale(scale);
187   - mRadialSweepView2.SetScale(scale);
188   - mRadialSweepView3.SetScale(scale);
189   -
190   - StartAnimation();
191   -}
192   -
193   -void RadialMenuExample::StartAnimation()
194   -{
195   - mDialView.SetOpacity(0.0f);
196   - mRadialSweepView1.SetOpacity(0.0f);
197   - mAnimation = Animation::New(6.0f);
198   - mRadialSweepView1.Activate(mAnimation, 0.0f, 3.0f);
199   - mRadialSweepView2.Activate(mAnimation, 1.5f, 3.0f);
200   - mRadialSweepView3.Activate(mAnimation, 3.0f, 3.0f);
201   - mAnimation.AnimateTo( Property( mDialView, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::EASE_IN, TimePeriod( 0.0f, 0.8f ) );
202   - mAnimation.AnimateTo( Property( mRadialSweepView1, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::EASE_IN, TimePeriod( 0.0f, 0.5f ) );
203   - mAnimation.FinishedSignal().Connect( this, &RadialMenuExample::OnAnimationFinished );
204   -
205   - mAnimationState = PLAYING;
206   - mAnimation.Play();
207   -}
208   -
209   -bool RadialMenuExample::OnButtonClicked( Toolkit::Button button )
210   -{
211   - switch( mAnimationState )
212   - {
213   - case PLAYING:
214   - {
215   - mAnimation.Pause();
216   - mAnimationState = PAUSED;
217   - mPlayStopButton.SetUnselectedImage( PLAY_ICON );
218   - mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED );
219   - }
220   - break;
221   -
222   - case PAUSED:
223   - {
224   - mAnimation.Play();
225   - mAnimationState = PLAYING;
226   - mPlayStopButton.SetUnselectedImage( STOP_ICON );
227   - mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED );
228   - }
229   - break;
230   -
231   - case STOPPED:
232   - {
233   - mPlayStopButton.SetUnselectedImage( STOP_ICON );
234   - mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED );
235   - mRadialSweepView1.Deactivate();
236   - mRadialSweepView2.Deactivate();
237   - mRadialSweepView3.Deactivate();
238   - StartAnimation();
239   - }
240   - }
241   - return false;
242   -}
243   -
244   -void RadialMenuExample::OnAnimationFinished( Animation& source )
245   -{
246   - mAnimationState = STOPPED;
247   - mPlayStopButton.SetUnselectedImage( PLAY_ICON );
248   - mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED );
249   -}
250   -
251   -RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName,
252   - Degree initialAngle,
253   - Degree finalAngle)
254   -{
255   - // Create the image
256   - mImageView = ImageView::New(imageName);
257   - mImageView.SetParentOrigin(ParentOrigin::CENTER);
258   - mImageView.SetAnchorPoint(AnchorPoint::CENTER);
259   - mImageView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
260   -
261   - // Create the stencil
262   - const ImageDimensions imageSize = ResourceImage::GetImageSize(imageName);
263   - float diameter = std::max(imageSize.GetWidth(), imageSize.GetHeight());
264   - RadialSweepView radialSweepView = RadialSweepView::New();
265   - radialSweepView.SetDiameter( diameter );
266   - radialSweepView.SetInitialAngle( initialAngle );
267   - radialSweepView.SetFinalAngle( finalAngle );
268   - radialSweepView.SetInitialSector( Degree(0.0f) );
269   - radialSweepView.SetFinalSector( Degree(359.999f) );
270   - radialSweepView.SetSize( Stage::GetCurrent().GetSize());
271   - radialSweepView.SetEasingFunction( Dali::AlphaFunction::EASE_IN_OUT );
272   - radialSweepView.SetParentOrigin( ParentOrigin::CENTER );
273   - mContents.Add(radialSweepView);
274   - radialSweepView.Add( mImageView );
275   - mImageView.SetParentOrigin( ParentOrigin::CENTER );
276   -
277   - return radialSweepView;
278   -}
279   -
280   -
281   -void RadialMenuExample::OnKeyEvent(const KeyEvent& event)
282   -{
283   - if(event.state == KeyEvent::Down)
284   - {
285   - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
286   - {
287   - mApplication.Quit();
288   - }
289   - }
290   -}
291   -
292   -void RunTest(Application app)
293   -{
294   - RadialMenuExample test(app);
295   -
296   - app.MainLoop();
297   -}
298   -
299   -// Entry point for Linux & Tizen applications
300   -int DALI_EXPORT_API main(int argc, char **argv)
301   -{
302   - Application app = Application::New(&argc, &argv, DEMO_THEME_PATH);
303   -
304   - RunTest(app);
305   -
306   - return 0;
307   -}
examples/radial-menu/radial-sweep-view-impl.cpp deleted
1   -/*
2   - * Copyright (c) 2016 Samsung Electronics Co., Ltd.
3   - *
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
7   - *
8   - * http://www.apache.org/licenses/LICENSE-2.0
9   - *
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.
15   - *
16   - */
17   -
18   -#include "radial-sweep-view-impl.h"
19   -
20   -#include <dali/public-api/rendering/renderer.h>
21   -#include <sstream>
22   -
23   -using namespace Dali;
24   -
25   -namespace
26   -{
27   -
28   -const char* VERTEX_SHADER_PREFIX( "#define MATH_PI_2 1.570796\n#define MATH_PI_4 0.785398\n" );
29   -
30   -const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
31   -attribute mediump float aAngleIndex;\n
32   -attribute mediump vec2 aPosition1;\n
33   -attribute mediump vec2 aPosition2;\n
34   -uniform mediump mat4 uMvpMatrix;\n
35   -uniform mediump float uStartAngle;\n
36   -uniform mediump float uRotationAngle;\n
37   -\n
38   -void main()\n
39   -{\n
40   - float currentAngle = uStartAngle + uRotationAngle;\n
41   - float angleInterval1 = MATH_PI_4 * aAngleIndex;\n
42   - vec4 vertexPosition = vec4(0.0, 0.0, 0.0, 1.0);\n
43   - if( currentAngle >= angleInterval1)\n
44   - {\n
45   - float angleInterval2 = angleInterval1 + MATH_PI_2;\n
46   - float angle = currentAngle < angleInterval2 ? currentAngle : angleInterval2;\n
47   - float delta;\n
48   - if( mod( aAngleIndex+4.0, 4.0) < 2.0 )\n
49   - {\n
50   - delta = 0.5 - 0.5*cos(angle) / sin(angle);\n
51   - }\n
52   - else\n
53   - {\n
54   - delta = 0.5 + 0.5*sin(angle) / cos(angle);\n
55   - }\n
56   - vertexPosition.xy = mix( aPosition1, aPosition2, delta );\n
57   - }\n
58   - gl_Position = uMvpMatrix * vertexPosition;\n
59   -}
60   -);
61   -
62   -const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
63   -uniform lowp vec4 uColor;\n
64   -\n
65   -void main()\n
66   -{\n
67   - gl_FragColor = uColor;\n
68   -}\n
69   -);
70   -
71   -float HoldZeroFastEaseInOutHoldOne(float progress)
72   -{
73   - if( progress < 0.2f)
74   - {
75   - return 0.0f;
76   - }
77   - else if(progress < 0.5f)
78   - {
79   - progress = (progress-0.2) / 0.3f;
80   - return progress*progress*progress*0.5f;
81   - }
82   - else if(progress < 0.8f)
83   - {
84   - progress = ((progress - 0.5f) / 0.3f) - 1.0f;
85   - return (progress*progress*progress+1.0f) * 0.5f + 0.5f;
86   - }
87   - else
88   - {
89   - return 1.0f;
90   - }
91   -}
92   -
93   -} // anonymous namespace
94   -
95   -
96   -RadialSweepView RadialSweepViewImpl::New( )
97   -{
98   - return New( 2.0f, 100.0f, ANGLE_0, ANGLE_0, ANGLE_0, ANGLE_360 );
99   -}
100   -
101   -
102   -RadialSweepView RadialSweepViewImpl::New( float duration, float diameter, Radian initialAngle, Radian finalAngle, Radian initialSector, Radian finalSector )
103   -{
104   - RadialSweepViewImpl* impl= new RadialSweepViewImpl(duration, diameter, initialAngle, finalAngle, initialSector, finalSector);
105   - RadialSweepView handle = RadialSweepView(*impl);
106   - return handle;
107   -}
108   -
109   -RadialSweepViewImpl::RadialSweepViewImpl( float duration, float diameter, Radian initialAngle, Radian finalAngle, Radian initialSector, Radian finalSector )
110   -: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ),
111   - mDuration(duration),
112   - mDiameter(diameter),
113   - mInitialAngle(initialAngle),
114   - mFinalAngle(finalAngle),
115   - mInitialSector(initialSector),
116   - mFinalSector(finalSector),
117   - mInitialActorAngle(0),
118   - mFinalActorAngle(0),
119   - mEasingFunction(HoldZeroFastEaseInOutHoldOne),
120   - mStartAngleIndex(Property::INVALID_INDEX),
121   - mRotationAngleIndex(Property::INVALID_INDEX),
122   - mRotateActorsWithStencil(false),
123   - mRotateActors(false)
124   -{
125   -}
126   -
127   -void RadialSweepViewImpl::SetDuration(float duration)
128   -{
129   - mDuration = duration;
130   -}
131   -
132   -void RadialSweepViewImpl::SetEasingFunction( Dali::AlphaFunction easingFunction )
133   -{
134   - mEasingFunction = easingFunction;
135   -}
136   -
137   -void RadialSweepViewImpl::SetDiameter(float diameter)
138   -{
139   - mDiameter = diameter;
140   -}
141   -
142   -void RadialSweepViewImpl::SetInitialAngle( Dali::Radian initialAngle)
143   -{
144   - mInitialAngle = initialAngle;
145   -}
146   -
147   -void RadialSweepViewImpl::SetFinalAngle( Dali::Radian finalAngle)
148   -{
149   - mFinalAngle = finalAngle;
150   -}
151   -
152   -void RadialSweepViewImpl::SetInitialSector( Dali::Radian initialSector)
153   -{
154   - mInitialSector = initialSector;
155   -}
156   -
157   -void RadialSweepViewImpl::SetFinalSector( Dali::Radian finalSector)
158   -{
159   - mFinalSector = finalSector;
160   -}
161   -
162   -void RadialSweepViewImpl::SetInitialActorAngle( Dali::Radian initialAngle )
163   -{
164   - mInitialActorAngle = initialAngle;
165   - mRotateActors = true;
166   -}
167   -
168   -void RadialSweepViewImpl::SetFinalActorAngle( Dali::Radian finalAngle )
169   -{
170   - mFinalActorAngle = finalAngle;
171   - mRotateActors = true;
172   -}
173   -
174   -float RadialSweepViewImpl::GetDuration( )
175   -{
176   - return mDuration;
177   -}
178   -
179   -float RadialSweepViewImpl::GetDiameter( )
180   -{
181   - return mDiameter;
182   -}
183   -
184   -Dali::Radian RadialSweepViewImpl::GetInitialAngle( )
185   -{
186   - return mInitialAngle;
187   -}
188   -
189   -Dali::Radian RadialSweepViewImpl::GetFinalAngle( )
190   -{
191   - return mFinalAngle;
192   -}
193   -
194   -Dali::Radian RadialSweepViewImpl::GetInitialSector( )
195   -{
196   - return mInitialSector;
197   -}
198   -
199   -Dali::Radian RadialSweepViewImpl::GetFinalSector( )
200   -{
201   - return mFinalSector;
202   -}
203   -
204   -Dali::Radian RadialSweepViewImpl::GetInitialActorAngle( )
205   -{
206   - return mInitialActorAngle;
207   -}
208   -
209   -Dali::Radian RadialSweepViewImpl::GetFinalActorAngle( )
210   -{
211   - return mFinalActorAngle;
212   -}
213   -
214   -void RadialSweepViewImpl::RotateActorsWithStencil(bool rotate)
215   -{
216   - mRotateActorsWithStencil = rotate;
217   -}
218   -
219   -void RadialSweepViewImpl::Add(Actor actor)
220   -{
221   - if( ! mLayer )
222   - {
223   - mLayer = Layer::New();
224   - Self().Add(mLayer);
225   - mLayer.SetSize( Stage::GetCurrent().GetSize() );
226   - mLayer.SetParentOrigin( ParentOrigin::CENTER );
227   - }
228   -
229   - mLayer.Add(actor);
230   -}
231   -
232   -void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float duration )
233   -{
234   - bool startAnimation=false;
235   - if( ! anim )
236   - {
237   - mAnim = Animation::New( mDuration );
238   - anim = mAnim;
239   - startAnimation = true;
240   - }
241   -
242   - if( ! mStencilActor )
243   - {
244   - CreateStencil( mInitialSector );
245   - mLayer.Add( mStencilActor );
246   - mStencilActor.SetScale(mDiameter);
247   - }
248   -
249   - mStencilActor.SetOrientation( mInitialAngle, Vector3::ZAXIS );
250   - mStencilActor.SetProperty( mRotationAngleIndex, mInitialSector.radian );
251   -
252   - if( mRotateActors )
253   - {
254   - for(unsigned int i=0, count=mLayer.GetChildCount(); i<count; i++)
255   - {
256   - Actor actor = mLayer.GetChildAt(i);
257   - if( actor != mStencilActor )
258   - {
259   - anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( mInitialActorAngle ), Vector3::ZAXIS ) );
260   - }
261   - }
262   - }
263   -
264   - anim.AnimateTo( Property( mStencilActor, mRotationAngleIndex ), mFinalSector.radian, mEasingFunction, TimePeriod( offsetTime, duration ) );
265   - anim.AnimateTo( Property( mStencilActor, Actor::Property::ORIENTATION ), Quaternion( Radian( mFinalAngle ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) );
266   -
267   - if( mRotateActorsWithStencil )
268   - {
269   - for(unsigned int i=0, count=mLayer.GetChildCount(); i<count; i++)
270   - {
271   - Actor actor = mLayer.GetChildAt(i);
272   - if( actor != mStencilActor )
273   - {
274   - anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( mFinalAngle.radian - mInitialAngle.radian ) , Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) );
275   - }
276   - }
277   - }
278   - else if( mRotateActors )
279   - {
280   - for(unsigned int i=0, count=mLayer.GetChildCount(); i<count; i++)
281   - {
282   - Actor actor = mLayer.GetChildAt(i);
283   - if( actor != mStencilActor )
284   - {
285   - anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( mFinalActorAngle ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) );
286   - }
287   - }
288   - }
289   -
290   -
291   - if( startAnimation )
292   - {
293   - anim.SetLooping(true);
294   - anim.Play();
295   - }
296   -}
297   -
298   -
299   -void RadialSweepViewImpl::Deactivate()
300   -{
301   - if( mAnim )
302   - {
303   - mAnim.Stop();
304   - }
305   -}
306   -
307   -void RadialSweepViewImpl::CreateStencil( Radian initialSector )
308   -{
309   - // Create the stencil mesh geometry
310   - // 3-----2
311   - // | \ / |
312   - // | 0--1 , 6
313   - // | / \ |
314   - // 4-----5
315   -
316   - struct VertexPosition { float angleIndex; Vector2 position1; Vector2 position2; };
317   - VertexPosition vertexData[7] = { // With X coordinate inverted to make the animation go anti clockwise from left center
318   - { 9.f, Vector2( 0.f, 0.f ), Vector2( 0.f, 0.f ) }, // center point, keep static
319   - { 0.f, Vector2( -0.5f, 0.f ), Vector2( -0.5f, 0.f ) }, // vertex 1, 0 degree, keep static
320   - { -1.f, Vector2( -0.5f, 0.5f ), Vector2( -0.5f, -0.5f ) }, // -45 ~ 45 degrees ( 0 ~ 45)
321   - { 1.f, Vector2( -0.5f, -0.5f ), Vector2( 0.5f, -0.5f ) }, // 45 ~ 135 degrees
322   - { 3.f, Vector2( 0.5f, -0.5f ), Vector2( 0.5f, 0.5f ) }, // 135 ~ 225 degrees
323   - { 5.f, Vector2( 0.5f, 0.5f ), Vector2( -0.5f, 0.5f ) }, // 225 ~ 315 degrees
324   - { 7.f, Vector2( -0.5f, 0.5f ), Vector2( -0.5f, -0.5f ) } // 315 ~ 405 degrees ( 315 ~ 359.999 )
325   - };
326   - Property::Map vertexFormat;
327   - vertexFormat["aAngleIndex"] = Property::FLOAT;
328   - vertexFormat["aPosition1"] = Property::VECTOR2;
329   - vertexFormat["aPosition2"] = Property::VECTOR2;
330   - PropertyBuffer vertices = PropertyBuffer::New( vertexFormat );
331   - vertices.SetData( vertexData, 7u );
332   -
333   - unsigned short indexData[15] = { 0,1,2,0,2,3,0,3,4,0,4,5,0,5,6 };
334   -
335   - Geometry meshGeometry = Geometry::New();
336   - meshGeometry.AddVertexBuffer( vertices );
337   - meshGeometry.SetIndexBuffer( &indexData[0], sizeof( indexData )/sizeof(indexData[0]) );
338   -
339   - // Create shader
340   - std::ostringstream vertexShaderStringStream;
341   - vertexShaderStringStream<<VERTEX_SHADER_PREFIX<<VERTEX_SHADER;
342   - Shader shader = Shader::New( vertexShaderStringStream.str(), FRAGMENT_SHADER );
343   -
344   - // Create renderer
345   - Renderer renderer = Renderer::New( meshGeometry, shader );
346   -
347   - mStencilActor = Actor::New();
348   - mStencilActor.AddRenderer( renderer );
349   - mStencilActor.SetSize(1.f, 1.f);
350   -
351   - // register properties
352   - mStartAngleIndex = mStencilActor.RegisterProperty("uStartAngle", 0.f);
353   - mRotationAngleIndex = mStencilActor.RegisterProperty("uRotationAngle", initialSector.radian);
354   -
355   - mStencilActor.SetDrawMode( DrawMode::STENCIL );
356   - mStencilActor.SetParentOrigin( ParentOrigin::CENTER );
357   -}
examples/radial-menu/radial-sweep-view-impl.h deleted
1   -#ifndef DALI_DEMO_RADIAL_SWEEP_VIEW_IMPL_H
2   -#define DALI_DEMO_RADIAL_SWEEP_VIEW_IMPL_H
3   -
4   -/*
5   - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6   - *
7   - * Licensed under the Apache License, Version 2.0 (the "License");
8   - * you may not use this file except in compliance with the License.
9   - * You may obtain a copy of the License at
10   - *
11   - * http://www.apache.org/licenses/LICENSE-2.0
12   - *
13   - * Unless required by applicable law or agreed to in writing, software
14   - * distributed under the License is distributed on an "AS IS" BASIS,
15   - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   - * See the License for the specific language governing permissions and
17   - * limitations under the License.
18   - *
19   - */
20   -
21   -#include <dali-toolkit/dali-toolkit.h>
22   -#include "radial-sweep-view.h"
23   -
24   -
25   -/********************************************************************************
26   - * Class to implement a layer with a radial sweep stencil mask and an actor tree
27   - */
28   -class RadialSweepViewImpl : public Dali::Toolkit::Internal::Control
29   -{
30   -public:
31   - static RadialSweepView New();
32   -
33   - static RadialSweepView New( float duration,
34   - float diameter,
35   - Dali::Radian initialAngle,
36   - Dali::Radian finalAngle,
37   - Dali::Radian initialSector,
38   - Dali::Radian finalSector );
39   -
40   - RadialSweepViewImpl( float duration,
41   - float diameter,
42   - Dali::Radian initialAngle,
43   - Dali::Radian finalAngle,
44   - Dali::Radian initialSector,
45   - Dali::Radian finalSector );
46   -
47   - void SetDuration(float duration);
48   - void SetEasingFunction( Dali::AlphaFunction easingFunction );
49   -
50   - void SetDiameter(float diameter);
51   - void SetInitialAngle( Dali::Radian initialAngle);
52   - void SetFinalAngle( Dali::Radian finalAngle);
53   - void SetInitialSector( Dali::Radian initialSector);
54   - void SetFinalSector( Dali::Radian finalSector);
55   - void SetInitialActorAngle( Dali::Radian initialAngle );
56   - void SetFinalActorAngle( Dali::Radian finalAngle );
57   -
58   - float GetDuration( );
59   - float GetDiameter( );
60   - Dali::Radian GetInitialAngle( );
61   - Dali::Radian GetFinalAngle( );
62   - Dali::Radian GetInitialSector( );
63   - Dali::Radian GetFinalSector( );
64   - Dali::Radian GetInitialActorAngle( );
65   - Dali::Radian GetFinalActorAngle( );
66   -
67   - void RotateActorsWithStencil(bool rotate);
68   -
69   - void Add( Dali::Actor actor );
70   -
71   - void Activate( Dali::Animation anim = Dali::Animation(), float offsetTime=0, float duration=2.0f );
72   -
73   - void Deactivate();
74   -
75   -private:
76   -
77   - /**
78   - * Create the stencil mask
79   - */
80   - void CreateStencil(Dali::Radian initialSector );
81   -
82   -private:
83   - Dali::Layer mLayer;
84   - Dali::Animation mAnim;
85   - float mDuration;
86   - float mDiameter;
87   - Dali::Radian mInitialAngle;
88   - Dali::Radian mFinalAngle;
89   - Dali::Radian mInitialSector;
90   - Dali::Radian mFinalSector;
91   - Dali::Radian mInitialActorAngle;
92   - Dali::Radian mFinalActorAngle;
93   - Dali::AlphaFunction mEasingFunction;
94   - Dali::Actor mStencilActor; ///< Stencil actor which generates mask
95   - Dali::Property::Index mStartAngleIndex; ///< Index of start-angle property
96   - Dali::Property::Index mRotationAngleIndex; ///< Index of rotation-angle property
97   - bool mRotateActorsWithStencil:1;
98   - bool mRotateActors;
99   -};
100   -
101   -
102   -inline RadialSweepViewImpl& GetImpl( RadialSweepView& obj )
103   -{
104   - DALI_ASSERT_ALWAYS(obj);
105   - Dali::RefObject& handle = obj.GetImplementation();
106   - return static_cast<RadialSweepViewImpl&>(handle);
107   -}
108   -
109   -inline const RadialSweepViewImpl& GetImpl( const RadialSweepView& obj )
110   -{
111   - DALI_ASSERT_ALWAYS(obj);
112   - const Dali::RefObject& handle = obj.GetImplementation();
113   - return static_cast<const RadialSweepViewImpl&>(handle);
114   -}
115   -
116   -
117   -
118   -#endif // DALI_DEMO_RADIAL_SWEEP_VIEW_IMPL_H
examples/radial-menu/radial-sweep-view.cpp deleted
1   -/*
2   - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3   - *
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
7   - *
8   - * http://www.apache.org/licenses/LICENSE-2.0
9   - *
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.
15   - *
16   - */
17   -
18   -#include "radial-sweep-view.h"
19   -#include "radial-sweep-view-impl.h"
20   -
21   -using namespace Dali;
22   -
23   -RadialSweepView::RadialSweepView()
24   -{
25   -}
26   -
27   -RadialSweepView::RadialSweepView(const RadialSweepView& handle)
28   -: Control(handle)
29   -{
30   -}
31   -
32   -RadialSweepView& RadialSweepView::operator=(const RadialSweepView& rhs)
33   -{
34   - if( &rhs != this )
35   - {
36   - Control::operator=(rhs);
37   - }
38   - return *this;
39   -}
40   -
41   -RadialSweepView::~RadialSweepView()
42   -{
43   -}
44   -
45   -RadialSweepView RadialSweepView::DownCast( BaseHandle handle )
46   -{
47   - return Control::DownCast<RadialSweepView, RadialSweepViewImpl>(handle);
48   -}
49   -
50   -RadialSweepView RadialSweepView::New( )
51   -{
52   - return RadialSweepViewImpl::New();
53   -}
54   -
55   -RadialSweepView RadialSweepView::New( float duration,
56   - float diameter,
57   - Radian initialAngle,
58   - Radian finalAngle,
59   - Radian initialSector,
60   - Radian finalSector )
61   -{
62   - return RadialSweepViewImpl::New(duration, diameter, initialAngle, finalAngle, initialSector, finalSector );
63   -}
64   -
65   -RadialSweepView::RadialSweepView( RadialSweepViewImpl& impl )
66   -: Control( impl )
67   -{
68   -}
69   -
70   -RadialSweepView::RadialSweepView( Dali::Internal::CustomActor* impl )
71   -: Control( impl )
72   -{
73   - VerifyCustomActorPointer<RadialSweepViewImpl>(impl);
74   -}
75   -
76   -void RadialSweepView::SetDuration(float duration)
77   -{
78   - GetImpl(*this).SetDuration(duration);
79   -}
80   -
81   -void RadialSweepView::SetEasingFunction( Dali::AlphaFunction easingFunction )
82   -{
83   - GetImpl(*this).SetEasingFunction( easingFunction );
84   -}
85   -
86   -void RadialSweepView::SetDiameter(float diameter)
87   -{
88   - GetImpl(*this).SetDiameter(diameter);
89   -}
90   -
91   -void RadialSweepView::SetInitialAngle( Dali::Radian initialAngle)
92   -{
93   - GetImpl(*this).SetInitialAngle(initialAngle);
94   -}
95   -
96   -void RadialSweepView::SetFinalAngle( Dali::Radian finalAngle)
97   -{
98   - GetImpl(*this).SetFinalAngle(finalAngle);
99   -}
100   -
101   -void RadialSweepView::SetInitialSector( Dali::Radian initialSector)
102   -{
103   - GetImpl(*this).SetInitialSector(initialSector);
104   -}
105   -
106   -void RadialSweepView::SetFinalSector( Dali::Radian finalSector)
107   -{
108   - GetImpl(*this).SetFinalSector(finalSector);
109   -}
110   -
111   -void RadialSweepView::SetInitialActorAngle( Dali::Radian initialAngle )
112   -{
113   - GetImpl(*this).SetInitialActorAngle(initialAngle);
114   -}
115   -
116   -void RadialSweepView::SetFinalActorAngle( Dali::Radian finalAngle )
117   -{
118   - GetImpl(*this).SetFinalActorAngle(finalAngle);
119   -}
120   -
121   -float RadialSweepView::GetDuration( )
122   -{
123   - return GetImpl(*this).GetDuration();
124   -}
125   -
126   -float RadialSweepView::GetDiameter( )
127   -{
128   - return GetImpl(*this).GetDiameter();
129   -}
130   -
131   -Dali::Radian RadialSweepView::GetInitialAngle( )
132   -{
133   - return GetImpl(*this).GetInitialAngle();
134   -}
135   -
136   -Dali::Radian RadialSweepView::GetFinalAngle( )
137   -{
138   - return GetImpl(*this).GetFinalAngle();
139   -}
140   -
141   -Dali::Radian RadialSweepView::GetInitialSector( )
142   -{
143   - return GetImpl(*this).GetInitialSector();
144   -}
145   -
146   -Dali::Radian RadialSweepView::GetFinalSector( )
147   -{
148   - return GetImpl(*this).GetFinalSector();
149   -}
150   -
151   -Dali::Radian RadialSweepView::GetInitialActorAngle( )
152   -{
153   - return GetImpl(*this).GetInitialActorAngle();
154   -}
155   -
156   -Dali::Radian RadialSweepView::GetFinalActorAngle( )
157   -{
158   - return GetImpl(*this).GetFinalActorAngle();
159   -}
160   -
161   -void RadialSweepView::RotateActorsWithStencil(bool rotate)
162   -{
163   - GetImpl(*this).RotateActorsWithStencil(rotate);
164   -}
165   -
166   -void RadialSweepView::Add(Actor actor)
167   -{
168   - GetImpl(*this).Add(actor);
169   -}
170   -
171   -void RadialSweepView::Activate()
172   -{
173   - GetImpl(*this).Activate();
174   -}
175   -
176   -void RadialSweepView::Activate( Dali::Animation anim, float offsetTime, float duration )
177   -{
178   - GetImpl(*this).Activate(anim, offsetTime, duration);
179   -}
180   -
181   -void RadialSweepView::Deactivate()
182   -{
183   - GetImpl(*this).Deactivate();
184   -}
examples/radial-menu/radial-sweep-view.h deleted
1   -#ifndef DALI_DEMO_RADIAL_SWEEP_VIEW_H
2   -#define DALI_DEMO_RADIAL_SWEEP_VIEW_H
3   -
4   -/*
5   - * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6   - *
7   - * Licensed under the Apache License, Version 2.0 (the "License");
8   - * you may not use this file except in compliance with the License.
9   - * You may obtain a copy of the License at
10   - *
11   - * http://www.apache.org/licenses/LICENSE-2.0
12   - *
13   - * Unless required by applicable law or agreed to in writing, software
14   - * distributed under the License is distributed on an "AS IS" BASIS,
15   - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   - * See the License for the specific language governing permissions and
17   - * limitations under the License.
18   - *
19   - */
20   -
21   -#include <dali-toolkit/dali-toolkit.h>
22   -
23   -class RadialSweepViewImpl;
24   -
25   -
26   -/********************************************************************************
27   - * Handle to RadialSweepView implementation
28   - */
29   -class RadialSweepView : public Dali::Toolkit::Control
30   -{
31   -public:
32   - /**
33   - * Create a new RadialSweepView with default parameters (2 second animation,
34   - * no rotation, sweeping out a full circle).
35   - */
36   - static RadialSweepView New( );
37   -
38   - /**
39   - * Create a new RadialSweepView.
40   - * @param[in] duration The duration of the sweep animation
41   - * @param[in] diameter The diameter of the stencil mask
42   - * @param[in] initialAngle The initial angle of the anticlockwise line of the sweep sector
43   - * @param[in] finalAngle The final angle of the anticlockwise line of the sweep sector
44   - * @param[in] initialSector The angle of the starting sector
45   - * @param[in] finalSector The angle of the sector at the end of the animation.
46   - * Note, to cover the entire circle, use a value of 359.9999 degrees, not zero or 360 degrees.
47   - *
48   - * initial sector
49   - * \ | .
50   - * \ | .
51   - * initialAngle \ | . final sector
52   - * \| _|
53   - * .________
54   - */
55   - static RadialSweepView New( float duration,
56   - float diameter,
57   - Dali::Radian initialAngle,
58   - Dali::Radian finalAngle,
59   - Dali::Radian initialSector,
60   - Dali::Radian finalSector );
61   -
62   - void SetDuration(float duration);
63   -
64   - void SetEasingFunction( Dali::AlphaFunction easingFunction );
65   -
66   - void SetDiameter(float diameter);
67   -
68   - void SetInitialAngle( Dali::Radian initialAngle);
69   -
70   - void SetFinalAngle( Dali::Radian finalAngle);
71   -
72   - void SetInitialSector( Dali::Radian initialSector);
73   -
74   - void SetFinalSector( Dali::Radian finalSector);
75   -
76   - void SetInitialActorAngle( Dali::Radian initialAngle );
77   -
78   - void SetFinalActorAngle( Dali::Radian finalAngle );
79   -
80   - float GetDuration( );
81   -
82   - float GetDiameter( );
83   -
84   - Dali::Radian GetInitialAngle( );
85   -
86   - Dali::Radian GetFinalAngle( );
87   -
88   - Dali::Radian GetInitialSector( );
89   -
90   - Dali::Radian GetFinalSector( );
91   -
92   - Dali::Radian GetInitialActorAngle( );
93   -
94   - Dali::Radian GetFinalActorAngle( );
95   -
96   - /**
97   - * @param[in] rotate True if the actors should rotate with the stencil
98   - */
99   - void RotateActorsWithStencil(bool rotate);
100   -
101   - /**
102   - * Add actors to the view
103   - */
104   - void Add(Actor actor);
105   -
106   - /**
107   - * Activate the sweep animation
108   - */
109   - void Activate( );
110   -
111   - void Activate( Dali::Animation anim, float offsetTime, float duration );
112   -
113   - /**
114   - * Deactivate the sweep animation
115   - */
116   - void Deactivate();
117   -
118   - /**
119   - * Default constructor. Create an uninitialized handle.
120   - */
121   - RadialSweepView();
122   -
123   - /**
124   - * Copy constructor
125   - */
126   - RadialSweepView(const RadialSweepView& handle);
127   -
128   - /**
129   - * Assignment operator
130   - */
131   - RadialSweepView& operator=(const RadialSweepView& rhs);
132   -
133   - /**
134   - * Destructor
135   - */
136   - ~RadialSweepView();
137   -
138   - /**
139   - * Downcast method
140   - */
141   - static RadialSweepView DownCast( BaseHandle handle );
142   -
143   -public: // Not for use by application developers
144   -
145   - RadialSweepView( RadialSweepViewImpl& impl );
146   -
147   - RadialSweepView( Dali::Internal::CustomActor* impl );
148   -};
149   -
150   -#endif
examples/renderer-stencil/renderer-stencil-example.cpp
... ... @@ -275,13 +275,10 @@ private:
275 275 renderer.SetTextures( textureSet );
276 276  
277 277 // Setup the renderer properties:
278   - // We are writing to the color buffer & culling back faces.
279   - renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, true );
  278 + // We are writing to the color buffer & culling back faces (no stencil is used for the main cube).
  279 + renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR );
280 280 renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK );
281 281  
282   - // No stencil is used for the main cube.
283   - renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::OFF );
284   -
285 282 // We do need to write to the depth buffer as other objects need to appear underneath this cube.
286 283 renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON );
287 284 // We do not need to test the depth buffer as we are culling the back faces.
... ... @@ -316,13 +313,10 @@ private:
316 313 renderer.SetTextures( planeTextureSet );
317 314  
318 315 // Setup the renderer properties:
319   - // We are writing to the color buffer & culling back faces (as we are NOT doing depth write).
320   - renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, true );
  316 + // We are writing to the color buffer & culling back faces as we are NOT doing depth write (no stencil is used for the floor).
  317 + renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR );
321 318 renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK );
322 319  
323   - // No stencil is used for the floor.
324   - renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::OFF );
325   -
326 320 // We do not write to the depth buffer as its not needed.
327 321 renderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::OFF );
328 322 // We do need to test the depth buffer as we need the floor to be underneath the cube.
... ... @@ -360,11 +354,9 @@ private:
360 354 Renderer renderer = CreateRenderer( planeGeometry, size, false, Vector4::ONE );
361 355  
362 356 // Setup the renderer properties:
363   - // The stencil plane is only for stencilling, so disable writing to color buffer.
364   - renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, false );
  357 + // The stencil plane is only for stencilling.
  358 + renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::STENCIL );
365 359  
366   - // Enable stencil. Draw to the stencil buffer (only).
367   - renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::ON );
368 360 renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::ALWAYS );
369 361 renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE, 1 );
370 362 renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_MASK, 0xFF );
... ... @@ -410,8 +402,9 @@ private:
410 402 renderer.SetTextures( textureSet );
411 403  
412 404 // Setup the renderer properties:
413   - // Write to color buffer so reflection is visible
414   - renderer.SetProperty( Renderer::Property::WRITE_TO_COLOR_BUFFER, true );
  405 + // Write to color buffer so reflection is visible.
  406 + // Also enable the stencil buffer, as we will be testing against it to only draw to areas within the stencil.
  407 + renderer.SetProperty( Renderer::Property::RENDER_MODE, RenderMode::COLOR_STENCIL );
415 408 // We cull to skip drawing the back faces.
416 409 renderer.SetProperty( Renderer::Property::FACE_CULLING_MODE, FaceCullingMode::BACK );
417 410  
... ... @@ -422,7 +415,6 @@ private:
422 415 renderer.SetProperty( Renderer::Property::BLEND_FACTOR_DEST_RGB, BlendFactor::ONE );
423 416  
424 417 // Enable stencil. Here we only draw to areas within the stencil.
425   - renderer.SetProperty( Renderer::Property::STENCIL_MODE, StencilMode::ON );
426 418 renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION, StencilFunction::EQUAL );
427 419 renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_REFERENCE, 1 );
428 420 renderer.SetProperty( Renderer::Property::STENCIL_FUNCTION_MASK, 0xff );
... ...
examples/renderer-stencil/renderer-stencil-shaders.h
... ... @@ -29,7 +29,7 @@ const char * const POSITION( &quot;aPosition&quot;);
29 29 const char * const NORMAL( "aNormal" );
30 30 const char * const TEXTURE( "aTexCoord" );
31 31  
32   -// Shader for todor (vertex):
  32 +// Shader for basic, per-vertex lighting (vertex):
33 33 const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
34 34 attribute mediump vec3 aPosition;
35 35 attribute highp vec3 aNormal;
... ... @@ -62,6 +62,7 @@ const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
62 62 }
63 63 );
64 64  
  65 +// Fragment shader.
65 66 const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
66 67 varying mediump vec2 vTexCoord;
67 68 varying mediump vec3 vIllumination;
... ... @@ -74,6 +75,7 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
74 75 }
75 76 );
76 77  
  78 +// Shader for basic, per-vertex lighting with texture (vertex):
77 79 const char* VERTEX_SHADER_TEXTURED = DALI_COMPOSE_SHADER(
78 80 attribute mediump vec3 aPosition;
79 81 attribute highp vec3 aNormal;
... ... @@ -107,6 +109,7 @@ const char* VERTEX_SHADER_TEXTURED = DALI_COMPOSE_SHADER(
107 109 }
108 110 );
109 111  
  112 +// Fragment shader.
110 113 const char* FRAGMENT_SHADER_TEXTURED = DALI_COMPOSE_SHADER(
111 114 varying mediump vec2 vTexCoord;
112 115 varying mediump vec3 vIllumination;
... ...
examples/size-negotiation/size-negotiation-example.cpp
... ... @@ -798,7 +798,7 @@ private:
798 798 Layer mContentLayer; ///< Content layer.
799 799  
800 800 Toolkit::TextLabel mTitleActor; ///< Title text.
801   - Toolkit::Popup mMenu; ///< The navigation menu todor.
  801 + Toolkit::Popup mMenu; ///< The navigation menu.
802 802 Toolkit::Popup mPopup; ///< The current example popup.
803 803  
804 804 Toolkit::ItemView mItemView; ///< ItemView to hold test images.
... ...
examples/sparkle/sparkle-effect-example.cpp 0 → 100644
  1 +/*
  2 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  3 + *
  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
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  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.
  15 + *
  16 + */
  17 +
  18 +#include <dali/dali.h>
  19 +#include <dali-toolkit/dali-toolkit.h>
  20 +
  21 +#include <sstream>
  22 +#include <algorithm>
  23 +#include <map>
  24 +
  25 +#include "shared/utility.h"
  26 +#include "sparkle-effect.h"
  27 +
  28 +using namespace Dali;
  29 +using Dali::Toolkit::ImageView;
  30 +
  31 +using namespace SparkleEffect;
  32 +
  33 +namespace // unnamed namespace
  34 +{
  35 +
  36 +//background image for normal status
  37 +const char * const CIRCLE_BACKGROUND_IMAGE( DEMO_IMAGE_DIR "sparkle_normal_background.png" );
  38 +//particle shape image
  39 +const char * const PARTICLE_IMAGE( DEMO_IMAGE_DIR "sparkle_particle.png" );
  40 +
  41 +float EaseOutSquare( float progress )
  42 +{
  43 + return 1.0f - (1.0f-progress) * (1.0f-progress);
  44 +}
  45 +
  46 +float CustomBounce( float progress )
  47 +{
  48 + float p = 1.f-progress;
  49 + p *=p;
  50 + return 17.68f*p*p*p*progress;
  51 +}
  52 +
  53 +float Mix( const Vector2& range, float a )
  54 +{
  55 + return range.x * a + range.y*(1.f-a)-0.001f;
  56 +}
  57 +
  58 +const Vector4 BACKGROUND_COLOR( 0.f, 0.f, 0.05f, 1.f );
  59 +
  60 +} // unnamed namespace
  61 +
  62 +// This example shows a sparkle particle effect
  63 +//
  64 +class SparkleEffectExample : public ConnectionTracker
  65 +{
  66 +public:
  67 +
  68 + /**
  69 + * Create the SparkleEffectExample
  70 + * @param[in] application The DALi application instance
  71 + */
  72 + SparkleEffectExample( Application& application )
  73 + : mApplication( application ),
  74 + mAnimationIndex( 0u ),
  75 + mShaking( false )
  76 + {
  77 + mApplication.InitSignal().Connect( this, &SparkleEffectExample::OnInit );
  78 + }
  79 +
  80 +private:
  81 +
  82 + /**
  83 + * Initialize the SparkleEffectExample
  84 + * @param[in] application The DALi application instance
  85 + */
  86 + void OnInit( Application& application )
  87 + {
  88 + Stage stage = Stage::GetCurrent();
  89 + stage.KeyEventSignal().Connect(this, &SparkleEffectExample::OnKeyEvent);
  90 + stage.SetBackgroundColor( BACKGROUND_COLOR );
  91 +
  92 + mCircleBackground = ImageView::New( CIRCLE_BACKGROUND_IMAGE );
  93 + mCircleBackground.SetParentOrigin( ParentOrigin::CENTER );
  94 + mCircleBackground.SetAnchorPoint( AnchorPoint::CENTER );
  95 +
  96 + stage.Add( mCircleBackground );
  97 +
  98 + mEffect = SparkleEffect::New();
  99 +
  100 + mMeshActor = CreateMeshActor();
  101 +
  102 + stage.Add( mMeshActor );
  103 +
  104 + mMeshActor.SetPosition( ACTOR_POSITION );
  105 + mMeshActor.SetScale( ACTOR_SCALE );
  106 +
  107 + mTapDetector = TapGestureDetector::New();
  108 + mTapDetector.Attach(mCircleBackground);
  109 + mTapDetector.DetectedSignal().Connect( this, &SparkleEffectExample::OnTap );
  110 +
  111 + mPanGestureDetector = PanGestureDetector::New();
  112 + mPanGestureDetector.DetectedSignal().Connect( this, &SparkleEffectExample::OnPan );
  113 + mPanGestureDetector.Attach( mCircleBackground );
  114 +
  115 + PlayWanderAnimation( 35.f );
  116 + }
  117 +
  118 + /**
  119 + * Create the mesh representing all the particles
  120 + */
  121 + Actor CreateMeshActor()
  122 + {
  123 + // shuffling to assign the color in random order
  124 + unsigned int* shuffleArray = new unsigned int[NUM_PARTICLE];
  125 + for( unsigned int i = 0; i<NUM_PARTICLE; i++ )
  126 + {
  127 + shuffleArray[i] = i;
  128 + }
  129 + std::random_shuffle(&shuffleArray[0],&shuffleArray[NUM_PARTICLE]);
  130 +
  131 + // Create vertices
  132 +
  133 + std::vector< Vertex > vertices;
  134 + std::vector< unsigned short > faces;
  135 +
  136 + for( unsigned int i = 0; i<NUM_PARTICLE; i++ )
  137 + {
  138 + float colorIndex = GetColorIndex( shuffleArray[i] );
  139 + AddParticletoMesh( vertices, faces, PATHS[i], colorIndex );
  140 + }
  141 +
  142 + delete [] shuffleArray;
  143 +
  144 + Property::Map vertexFormat;
  145 + vertexFormat["aTexCoord"] = Property::VECTOR2;
  146 + vertexFormat["aParticlePath0"] = Property::VECTOR2;
  147 + vertexFormat["aParticlePath1"] = Property::VECTOR2;
  148 + vertexFormat["aParticlePath2"] = Property::VECTOR2;
  149 + vertexFormat["aParticlePath3"] = Property::VECTOR2;
  150 + vertexFormat["aParticlePath4"] = Property::VECTOR2;
  151 + vertexFormat["aParticlePath5"] = Property::VECTOR2;
  152 +
  153 + PropertyBuffer propertyBuffer = PropertyBuffer::New( vertexFormat );
  154 + propertyBuffer.SetData( &vertices[0], vertices.size() );
  155 +
  156 + Geometry geometry = Geometry::New();
  157 + geometry.AddVertexBuffer( propertyBuffer );
  158 + geometry.SetIndexBuffer( &faces[0], faces.size() );
  159 + geometry.SetType( Geometry::TRIANGLES );
  160 +
  161 + Texture particleTexture = DemoHelper::LoadTexture( PARTICLE_IMAGE );
  162 + TextureSet textureSet = TextureSet::New();
  163 + textureSet.SetTexture( 0u, particleTexture );
  164 +
  165 + Renderer renderer = Renderer::New( geometry, mEffect );
  166 + renderer.SetTextures( textureSet );
  167 +
  168 + Actor meshActor = Actor::New();
  169 + meshActor.SetParentOrigin( ParentOrigin::CENTER );
  170 + meshActor.SetSize( 1, 1 );
  171 + meshActor.AddRenderer( renderer );
  172 +
  173 + return meshActor;
  174 + }
  175 +
  176 + /**
  177 + * Defines a rule to assign particle with a color according to its index
  178 + */
  179 + float GetColorIndex( unsigned int particleIndex )
  180 + {
  181 + unsigned int thereshold = 0;
  182 + for( unsigned int i = 0; i<NUM_COLOR; i++ )
  183 + {
  184 + thereshold += PARTICLE_COLORS[i].numParticle;
  185 + if( particleIndex < thereshold)
  186 + {
  187 + return i + Mix( PARTICLE_COLORS[i].AlphaRange, static_cast<float>(thereshold-particleIndex)/PARTICLE_COLORS[i].numParticle );
  188 + }
  189 + }
  190 + return NUM_COLOR-1;
  191 + }
  192 +
  193 + /**
  194 + * All a particle to the mesh by giving the moving path and color index
  195 + *
  196 + * Two triangles per particle
  197 + * 0---------3
  198 + * |\ |
  199 + * | \ |
  200 + * | \ |
  201 + * | \|
  202 + * 1---------2
  203 + *
  204 + * The information we need to pass in through attribute include:
  205 + *
  206 + * path which contains 12 integer
  207 + * ---- passed in 6 Vector2 attributes
  208 + *
  209 + * color index, particle index and textureCoor( (0,0) or (1,0) or (0,1) or (1,1) )
  210 + * ---- package these info into texCood attribute as: (+-colorIndex, +-particleIndex)
  211 + */
  212 + void AddParticletoMesh( std::vector< Vertex >& vertices,
  213 + std::vector< unsigned short >& faces,
  214 + MovingPath& movingPath,
  215 + float colorIndex )
  216 + {
  217 + unsigned int idx = vertices.size();
  218 +
  219 + // store the path into position and normal, which would be decoded inside the shader
  220 + Vector2 particlePath0( movingPath[0], movingPath[1] );
  221 + Vector2 particlePath1( movingPath[2], movingPath[3] );
  222 + Vector2 particlePath2( movingPath[4], movingPath[5] );
  223 + Vector2 particlePath3( movingPath[6], movingPath[7] );
  224 + Vector2 particlePath4( movingPath[8], movingPath[9] );
  225 + Vector2 particlePath5( movingPath[10], movingPath[11] );
  226 +
  227 + float particleIdx = static_cast<float>(idx/4 + 1); // count from 1
  228 + float colorIdx = colorIndex+1.f; // count from 1
  229 + vertices.push_back( Vertex( Vector2(-colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5 ) );
  230 + vertices.push_back( Vertex( Vector2(-colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5 ) );
  231 + vertices.push_back( Vertex( Vector2( colorIdx, particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5 ) );
  232 + vertices.push_back( Vertex( Vector2( colorIdx, -particleIdx), particlePath0, particlePath1, particlePath2, particlePath3, particlePath4, particlePath5 ) );
  233 +
  234 + faces.push_back(idx);
  235 + faces.push_back(idx+1);
  236 + faces.push_back(idx+2);
  237 +
  238 + faces.push_back(idx);
  239 + faces.push_back(idx+2);
  240 + faces.push_back(idx+3);
  241 + }
  242 +
  243 + /*
  244 + * Main key event handler
  245 + */
  246 + void OnKeyEvent(const KeyEvent& event)
  247 + {
  248 + if(event.state == KeyEvent::Down)
  249 + {
  250 + if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) )
  251 + {
  252 + mApplication.Quit();
  253 + }
  254 + }
  255 + }
  256 +
  257 + /**
  258 + * Callback of the TapGesture
  259 + */
  260 + void OnTap( Actor actor, const TapGesture& tap )
  261 + {
  262 + {
  263 + PlayTapAnimation(5.f, tap.localPoint);
  264 + }
  265 + }
  266 +
  267 + /**
  268 + * Callback of the PanGesture
  269 + */
  270 + void OnPan( Actor actor, const PanGesture& gesture )
  271 + {
  272 + if( gesture.state == Gesture::Finished )
  273 + {
  274 + switch(mAnimationIndex)
  275 + {
  276 + case 0:
  277 + {
  278 + PlayParticleFadeAnimation(0, NUM_PARTICLE, 0.f, 3.f );
  279 + break;
  280 + }
  281 + case 1:
  282 + {
  283 + PlayBreakAnimation(2.0f);
  284 + break;
  285 + }
  286 + case 2:
  287 + {
  288 + PlayShakeAnimation(0.5f, 2.5f);
  289 + break;
  290 + }
  291 + default:
  292 + {
  293 + break;
  294 + }
  295 + }
  296 +
  297 + mAnimationIndex = (mAnimationIndex+1)%3;
  298 + }
  299 + }
  300 +
  301 + /**
  302 + * Animate the particle position to make them wandering on the screen with 'seemingly' random fade in/out
  303 + * @param[in] duration The duration for the particle to move a cycle on the path. the bigger this value the slower the floating movement.
  304 + * @param[in] looping Infinite playing or not
  305 + */
  306 + void PlayWanderAnimation( float duration, bool looping = true )
  307 + {
  308 + Animation wanderAnimation= Animation::New(duration);
  309 + wanderAnimation.AnimateTo( Property( mEffect, PERCENTAGE_UNIFORM_NAME ), 1.f );
  310 + wanderAnimation.SetLooping(looping); // infinite playing
  311 +
  312 + wanderAnimation.Play();
  313 + }
  314 +
  315 + /**
  316 + * Accelerate the particle moving speed
  317 + * @param[in] cycle How many extra cycles to move during the animation
  318 + * @param[in] duration The duration for the animation
  319 + */
  320 + void PlayShakeAnimation( float cycle, float duration )
  321 + {
  322 + if( mShaking )
  323 + {
  324 + return;
  325 + }
  326 + DestroyAnimation( mTapAnimationAux );
  327 +
  328 + float accelaration = GetFloatUniformValue( ACCELARATION_UNIFORM_NAME );
  329 + mEffect.SetProperty( mEffect.GetPropertyIndex(ACCELARATION_UNIFORM_NAME), accelaration - int( accelaration) ); // Set the value as its fractional part
  330 + Animation shakeAnimation = Animation::New(duration);
  331 + shakeAnimation.AnimateBy( Property( mEffect, ACCELARATION_UNIFORM_NAME ), cycle, AlphaFunction::EASE_OUT );
  332 + shakeAnimation.FinishedSignal().Connect( this, &SparkleEffectExample::OnShakeAnimationFinished );
  333 +
  334 + shakeAnimation.Play();
  335 + mShaking = true;
  336 + }
  337 +
  338 + /**
  339 + * Animate the particles to appear from center and spread all over around
  340 + * @param[in] duration The duration for the animation
  341 + */
  342 + void PlayBreakAnimation( float duration )
  343 + {
  344 + if( GetFloatUniformValue(BREAK_UNIFORM_NAME) > 0.f )
  345 + {
  346 + return;
  347 + }
  348 +
  349 + // Stop the fading / tap animation before the breaking
  350 + DestroyAnimation( mFadeAnimation);
  351 + mTapIndices.x = mTapIndices.y;
  352 + mEffect.SetProperty( mEffect.GetPropertyIndex( TAP_INDICES_UNIFORM_NAME ), mTapIndices );
  353 + mEffect.SetProperty( mEffect.GetPropertyIndex( ACCELARATION_UNIFORM_NAME ), 0.f );
  354 +
  355 + // prepare the animation by setting the uniform to the required value
  356 + mEffect.SetProperty( mEffect.GetPropertyIndex( BREAK_UNIFORM_NAME ), 1.f );
  357 + mMeshActor.SetScale(0.01f);
  358 + mEffect.SetProperty( mEffect.GetPropertyIndex( "uScale" ), 0.01f );
  359 + mMeshActor.SetPosition( 0.f, 0.f, 1.f );
  360 +
  361 + Animation breakAnimation = Animation::New(duration*1.5f);
  362 + breakAnimation.AnimateTo( Property(mMeshActor, Actor::Property::SCALE), Vector3(ACTOR_SCALE,ACTOR_SCALE,ACTOR_SCALE), EaseOutSquare);
  363 + breakAnimation.AnimateTo( Property( mEffect, "uScale" ), ACTOR_SCALE, EaseOutSquare);
  364 + breakAnimation.AnimateTo( Property(mMeshActor, Actor::Property::POSITION), ACTOR_POSITION, EaseOutSquare);
  365 + breakAnimation.FinishedSignal().Connect( this, &SparkleEffectExample::OnBreakAnimationFinished );
  366 +
  367 + float timeUnit = duration/ (NUM_PARTICLE+1) /(NUM_PARTICLE+1) ;
  368 + std::ostringstream oss;
  369 + for(unsigned int i = 0; i<NUM_PARTICLE; i++)
  370 + {
  371 + oss.str("");
  372 + oss<< OPACITY_UNIFORM_NAME<< i << "]";
  373 + mEffect.SetProperty( mEffect.GetPropertyIndex( oss.str() ), 0.01f);
  374 + float timeSlice = timeUnit*i*i;
  375 + breakAnimation.AnimateTo( Property( mEffect, oss.str() ), 1.f, AlphaFunction::EASE_IN_OUT_SINE, TimePeriod( timeSlice*0.5f, timeSlice ) );
  376 + }
  377 +
  378 + breakAnimation.Play();
  379 + }
  380 +
  381 + /**
  382 + * Animate the particle opacity
  383 + * Particles with index between startIndex ~ startIndex+numParticle-1 fade to the target opacity one after another
  384 + * @param[in] startIndex The index of the first particle
  385 + * @param[in] numParticle The number of particle to change opacity
  386 + * @param[in] targetValue The final opacity
  387 + * @param[in] duration The duration for the animation
  388 + */
  389 + void PlayParticleFadeAnimation( unsigned int startIndex, unsigned int numParticle, float targetValue, float duration )
  390 + {
  391 + if( GetFloatUniformValue(BREAK_UNIFORM_NAME) > 0.f )
  392 + {
  393 + return;
  394 + }
  395 +
  396 + // start the opacity animation one particle after another gradually
  397 + float timeSlice = duration / (numParticle+1);
  398 + float fadeDuration = timeSlice>0.5f ? timeSlice : 0.5f;
  399 +
  400 + Animation fadeAnimation= Animation::New(duration+fadeDuration*2.f);
  401 + std::ostringstream oss;
  402 + for(unsigned int i = startIndex; i<numParticle; i++)
  403 + {
  404 + if( i>=NUM_PARTICLE ) break; // out of bound
  405 +
  406 + oss.str("");
  407 + oss<< OPACITY_UNIFORM_NAME<< i << "]";
  408 + fadeAnimation.AnimateTo(Property( mEffect, oss.str()), targetValue, TimePeriod( timeSlice*i, fadeDuration*2.f ));
  409 + }
  410 +
  411 + fadeAnimation.Play();
  412 + mFadeAnimation = fadeAnimation;
  413 + mFadeAnimation.FinishedSignal().Connect( this, &SparkleEffectExample::OnFadeAnimationFinished );
  414 + }
  415 +
  416 + /**
  417 + * Push the particles to the edge all around the circle then bounce back
  418 + * @param[in] duration The duration for the animation
  419 + * @param[in] tapPoint The position of the tap point
  420 + */
  421 + void PlayTapAnimation(float duration, const Vector2& tapPoint )
  422 + {
  423 + if( mTapIndices.y > mTapIndices.x && mTapAnimation.GetCurrentProgress() < 0.2f)
  424 + {
  425 + return;
  426 + }
  427 +
  428 + Animation animation= Animation::New(duration);
  429 + int idx = int(mTapIndices.y)%MAXIMUM_ANIMATION_COUNT;
  430 + mTapIndices.y += 1.f;
  431 +
  432 + std::ostringstream oss;
  433 + oss<< TAP_OFFSET_UNIFORM_NAME<< idx << "]";
  434 + mEffect.SetProperty( mEffect.GetPropertyIndex( oss.str() ), 0.f);
  435 + animation.AnimateTo( Property( mEffect, oss.str() ), 0.75f, CustomBounce);
  436 +
  437 + oss.str("");
  438 + oss<< TAP_POINT_UNIFORM_NAME<< idx << "]";
  439 + mEffect.SetProperty( mEffect.GetPropertyIndex( oss.str() ), tapPoint/ACTOR_SCALE);
  440 +
  441 + mEffect.SetProperty( mEffect.GetPropertyIndex( TAP_INDICES_UNIFORM_NAME ), mTapIndices);
  442 +
  443 + if(!mShaking)
  444 + {
  445 + mTapAnimationAux = Animation::New(duration*0.2f);
  446 + mTapAnimationAux.AnimateBy( Property( mEffect, ACCELARATION_UNIFORM_NAME ), 0.15f, AlphaFunction::EASE_IN_OUT );
  447 + mTapAnimationAux.Play();
  448 + }
  449 + animation.Play();
  450 + mTapAnimationIndexPair[animation] = static_cast<int>(mTapIndices.y -1.f);
  451 + animation.FinishedSignal().Connect( this, &SparkleEffectExample::OnTapAnimationFinished );
  452 + mTapAnimation = animation;
  453 + }
  454 +
  455 + /**
  456 + * Callback of the animation finished signal
  457 + */
  458 + void OnShakeAnimationFinished( Animation& animation)
  459 + {
  460 + mShaking = false;
  461 + }
  462 +
  463 + /**
  464 + * Callback of the animation finished signal
  465 + */
  466 + void OnFadeAnimationFinished( Animation& animation)
  467 + {
  468 + mFadeAnimation.Clear();
  469 + mFadeAnimation.Reset();
  470 + }
  471 +
  472 + /**
  473 + * Callback of the animation finished signal
  474 + */
  475 + void OnBreakAnimationFinished( Animation& animation)
  476 + {
  477 + mEffect.SetProperty( mEffect.GetPropertyIndex( BREAK_UNIFORM_NAME ), 0.f );
  478 + }
  479 +
  480 + /**
  481 + * Callback of the animation finished signal
  482 + */
  483 + void OnTapAnimationFinished( Animation& animation )
  484 + {
  485 + if( mTapAnimationIndexPair[animation] == static_cast<int>(mTapIndices.x) )
  486 + {
  487 + mTapIndices.x += 1.f;
  488 + if( mTapIndices.x >= mTapIndices.y )
  489 + {
  490 + mTapIndices = Vector2::ZERO;
  491 + }
  492 + mEffect.SetProperty( mEffect.GetPropertyIndex( TAP_INDICES_UNIFORM_NAME ), mTapIndices);
  493 + }
  494 +
  495 + mTapAnimationIndexPair.erase( animation );
  496 + if( mTapAnimationIndexPair.size() < 1 && mTapIndices != Vector2::ZERO)
  497 + {
  498 + mTapIndices = Vector2::ZERO;
  499 + mEffect.SetProperty( mEffect.GetPropertyIndex( TAP_INDICES_UNIFORM_NAME ), mTapIndices);
  500 + }
  501 +
  502 + animation.Clear();
  503 + animation.Reset();
  504 + }
  505 +
  506 + /**
  507 + * Helper retrieve a uniform value from the Sparkle effect shader
  508 + * @param[in] uniformName The uniform
  509 + * @return The float value
  510 + */
  511 + float GetFloatUniformValue( const std::string& uniformName )
  512 + {
  513 + float value;
  514 + mEffect.GetProperty(mEffect.GetPropertyIndex(uniformName)).Get(value);
  515 + return value;
  516 + }
  517 +
  518 + /**
  519 + * Terminate the given animation
  520 + */
  521 + void DestroyAnimation( Animation& animation )
  522 + {
  523 + if( animation )
  524 + {
  525 + animation.Clear();
  526 + animation.Reset();
  527 + }
  528 + }
  529 +
  530 +private:
  531 +
  532 + Application& mApplication;
  533 + Shader mEffect;
  534 + ImageView mCircleBackground;
  535 + Actor mMeshActor;
  536 +
  537 + PanGestureDetector mPanGestureDetector;
  538 + TapGestureDetector mTapDetector;
  539 +
  540 + Animation mFadeAnimation;
  541 + Animation mTapAnimation;
  542 + Animation mTapAnimationAux;
  543 +
  544 + Vector2 mTapIndices;
  545 + unsigned int mAnimationIndex;
  546 + bool mShaking;
  547 +
  548 + std::map< Animation, int > mTapAnimationIndexPair;
  549 +};
  550 +
  551 +void RunTest( Application& application )
  552 +{
  553 + SparkleEffectExample theApp( application );
  554 +
  555 + application.MainLoop();
  556 +}
  557 +
  558 +// Entry point for Linux & Tizen applications
  559 +//
  560 +int DALI_EXPORT_API main( int argc, char **argv )
  561 +{
  562 + Application application = Application::New( &argc, &argv );
  563 +
  564 + RunTest( application );
  565 +
  566 + return 0;
  567 +}
  568 +
... ...
examples/sparkle/sparkle-effect.h 0 → 100644
  1 +#ifndef DALI_SPARKLE_EFFECT_H
  2 +#define DALI_SPARKLE_EFFECT_H
  3 +
  4 +/*
  5 + * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  6 + *
  7 + * Licensed under the Apache License, Version 2.0 (the "License");
  8 + * you may not use this file except in compliance with the License.
  9 + * You may obtain a copy of the License at
  10 + *
  11 + * http://www.apache.org/licenses/LICENSE-2.0
  12 + *
  13 + * Unless required by applicable law or agreed to in writing, software
  14 + * distributed under the License is distributed on an "AS IS" BASIS,
  15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16 + * See the License for the specific language governing permissions and
  17 + * limitations under the License.
  18 + *
  19 + */
  20 +
  21 +#include <dali/dali.h>
  22 +#include <dali-toolkit/dali-toolkit.h>
  23 +
  24 +using namespace Dali;
  25 +using Dali::Toolkit::ImageView;
  26 +
  27 +/************************************************************/
  28 +/* Custom sparkle effect shader******************************/
  29 +/************************************************************/
  30 +
  31 +namespace SparkleEffect
  32 +{
  33 + // uniform which controls the position of particle on the path
  34 + const std::string PERCENTAGE_UNIFORM_NAME( "uPercentage" );
  35 + // uniform array of particle color, set their value as the PARTICLE_COLORS given below
  36 + const std::string PARTICLE_COLOR_UNIFORM_NAME("uParticleColors[");
  37 + // uniform array of particle opacity
  38 + const std::string OPACITY_UNIFORM_NAME("uOpacity[");
  39 + // uniform which offsets the path control point, with this values >=0, the paths are squeezed towards the GatheringPoint
  40 + const std::string ACCELARATION_UNIFORM_NAME("uAcceleration");
  41 + // uniform which indicates the ongoing tap animations
  42 + const std::string TAP_INDICES_UNIFORM_NAME("uTapIndices");
  43 + // uniform which controls how much the offset of the midpoints relative to the start/end points of the cubic bezier curve when the path is squeezed for tap animation
  44 + const std::string TAP_OFFSET_UNIFORM_NAME("uTapOffset[");
  45 + // uniform which gives the position of the tapping, in this way the particles will be pushed away from this point
  46 + const std::string TAP_POINT_UNIFORM_NAME("uTapPoint[");
  47 + // uniform which trigger the break animation, set to 1.0 when break animation is playing, otherwise set to 0.0
  48 + const std::string BREAK_UNIFORM_NAME("uBreak");
  49 +
  50 + /****************particle colors******************/
  51 +
  52 + struct ParticleColor
  53 + {
  54 + Vector3 RGB;
  55 + Vector2 AlphaRange;
  56 + unsigned int numParticle;
  57 + };
  58 +
  59 + ParticleColor PARTICLE_COLORS[]=
  60 + {
  61 + { Vector3( 0.f, 240.f, 255.f )/255.f, Vector2( 0.2f, 1.f ), 22 }, // 00f0ff, opacity 20%~100%
  62 + { Vector3( 89.f, 151.f, 239.f )/255.f, Vector2( 0.2f, 0.5f ), 12 }, // 5997ef, opacity 20%~50%
  63 + { Vector3( 181.f, 181.f, 207.f )/255.f, Vector2( 0.5f, 1.f ), 22 }, // b5b5cf, opacity 50%~100%
  64 + { Vector3( 147.f, 147.f, 170.f )/255.f, Vector2( 0.5f, 0.5f ), 22 }, // 9393aa, opacity 50%~50%
  65 + { Vector3( 145.f, 145.f, 201.f )/255.f, Vector2( 1.f, 1.f ), 12 }, // 91bdc9, opacity 100%~100%
  66 + { Vector3( 145.f, 145.f, 201.f )/255.f, Vector2( 0.2f, 0.2f ), 21 } // 91bdc9, opacity 20%~20%
  67 + };
  68 + const unsigned int NUM_COLOR( sizeof( PARTICLE_COLORS ) / sizeof( PARTICLE_COLORS[0] ) );
  69 +
  70 + /***************particle moving paths********************/
  71 +
  72 + typedef int MovingPath[12];
  73 +
  74 + // these paths are defined inside the circle which has the center at (250, 250) and the radius as 250
  75 + MovingPath PATHS[]=
  76 + { // each path is composed of two cubic b-curves: (p0, p1, p2, p3) & (p3, p4, p5, p0)
  77 + // p0 p1 p2 p3 p4 p5
  78 + { 280,273, 386,41, 489,141, 491,199, 494,256, 230,394 },
  79 + { 129,226, 357,120, 150,491, 291,406, 433,320, 47,283 },
  80 + { 96,264, 356,133, 446,196, 370,297, 294,399, -169,384 },
  81 + { 345,110, 359,186, 14,393, 4,247, -6,101, 321,-28 },
  82 + { 166,161, 128,353, 566,200, 487,304, 413,403, 203,-32 },
  83 + { 193,286, 106,331, 206,569, 334,477, 462,385, 279,240 },
  84 + { 336,247, 293,232, 301,465, 346,479, 390,493, 374,261 },
  85 + { 250,72, 314,72, 332,495, 250,497, 168,499, 161,72 },
  86 + { 48,387, 32,241, 452,558, 433,358, 411,121, 62,523 },
  87 + { 300,32, 159,27, 442,568, 186,492, -70,415, 551,41 },
  88 + { 479,150, 503,203, 216,403, 163,298, 110,193, 448,78 },
  89 + { 346,75, 311,97, 336,196, 389,160, 442,123, 383,51 },
  90 + { 90,61, 54,96, 218,373, 294,300, 370,227, 141,11 },
  91 + { 126,225, 240,280, 378,29, 221,16, 64,4, 11,170 },
  92 + { 308,101, 243,22, -10,271, 22,352, 49,422, 396,208 },
  93 + { 193,188, 174,302, 502,389, 500,250, 498,111, 212,72 },
  94 + { 227,3, 16,35, 577,309, 428,423, 279,537, 438,-28 },
  95 + { 410,58, 387,18, 22,179, 154,277, 286,374, 459,142 },
  96 + { 178,272, 109,299, 144,429, 218,396, 293,362, 221,254 },
  97 + { 247,46, 98,5, -91,357, 160,431, 412,505, 397,88 },
  98 + { 41,112, 22,144, 123,273, 158,187, 192,101, 75,56 },
  99 + { 8,300, 23,340, 267,294, 238,218, 209,142, -20,226 },
  100 + { 112,256, 24,270, -1,470, 154,433, 308,396, 201,242 },
  101 + { 212,277, 267,346, 509,202, 452,103, 398,8, 150,199 },
  102 + { 154,205, 146,287, 496,282, 492,194, 488,107, 160,140 },
  103 + { 281,350, 365,318, 415,476, 332,482, 248,489, 204,379 },
  104 + { 327,23, 346,81, 154,319, 123,207, 92,95, 313,-21 },
  105 + { 323,233, 283,307, 454,420, 478,354, 501,288, 374,136 },
  106 + { 318,186, 311,252, 488,248, 481,168, 474,87, 328,76 },
  107 + { 7,192, -10,270, 249,398, 269,307, 290,216, 25,111 },
  108 + { 148,22, 98,22, 25,458, 125,458, 225,458, 198,22 },
  109 + { 349,32, 307,39, 492,416, 399,446, 305,477, 460,16 },
  110 + { 147,474, 222,554, 392,154, 486,240, 581,325, 73,394 },
  111 + { 57,186, 13,200, 51,398, 114,374, 178,349, 97,174 },
  112 + { 257,192, 198,188, 162,345, 240,349, 319,354, 316,197 },
  113 + { 242,4, 283,21, 30,172, 81,215, 133,257, 209,-10 },
  114 + { 149,408, 165,442, 472,340, 444,275, 416,210, 120,348 },
  115 + { 106,271, 136,359, 483,370, 422,186, 360,2, 76,186 },
  116 + { 120,146, 29,224, 469,262, 346,390, 222,518, 393,-87 },
  117 + { 318,265, 415,280, 398,537, 247,491, 96,446, 222,249 },
  118 + { 171,275, 207,246, 274,469, 237,497, 199,525, 139,300 },
  119 + { 196,84, 135,105, 256,510, 334,486, 412,462, 280,55 },
  120 + { 485,314, 452,170, 158,606, 111,411, 55,179, 515,446 },
  121 + { 134,54, 266,4, 175,607, 392,451, 609,296, -100,144 },
  122 + { 3,229, -1,287, 334,383, 350,267, 366,150, 10,151 },
  123 + { 105,115, 146,125, 154,227, 92,209, 30,192, 62,105 },
  124 + { 343,20, 388,42, 323,357, 228,313, 132,269, 278,-10 },
  125 + { 362,186, 271,274, 60,82, 204,19, 349,-44, 453,97 },
  126 + { 145,128, 181,32, 501,185, 498,272, 495,347, 97,257 },
  127 + { 286,172, 342,274, 59,463, 16,331, -27,198, 231,69 },
  128 + { 194,7, 404,-32, -38,410, 140,469, 317,528, -16,45 },
  129 + { 39,120, 48,74, 445,109, 352,244, 259,379, 20,215 },
  130 + { 328,247, 402,250, 411,384, 330,377, 248,370, 281,244 },
  131 + { 189,56, 317,-31, 610,240, 396,392, 183,543, 61,144 },
  132 + { 402,53, 430,77, 376,231, 315,161, 255,91, 351,10 },
  133 + { 496,218, 494,260, 249,296, 251,214, 254,133, 498,139 },
  134 + { 381,210, 469,195, 557,376, 399,391, 241,407, 292,226 },
  135 + { 297,263, 267,346, -8,289, 14,176, 35,69, 331,168 },
  136 + { 329,187, 363,263, 30,371, 5,287, -19,203, 302,128 },
  137 + { 257,354, 168,351, 171,516, 252,496, 333,475, 340,356 },
  138 + { 106,60, 107,121, 366,284, 359,168, 352,52, 105,14 },
  139 + { 178,257, 240,314, 115,476, 71,421, 28,367, 98,182 },
  140 + { 163,213, 191,273, 22,327, 3,248, -17,170, 118,113 },
  141 + { 459,117, 500,185, 297,390, 248,311, 199,232, 416,46 },
  142 + { 270,3, 317,-14, 528,375, 434,407, 339,440, 223,19 },
  143 + { 88,76, 130,68, 78,485, 176,483, 274,482, -22,96 },
  144 + { 422,428, 378,528, 88,205, 26,317, -36,428, 467,328 },
  145 + { 414,127, 460,125, 489,325, 421,322, 353,320, 372,128 },
  146 + { 227,197, 281,174, 367,311, 294,340, 221,370, 173,220 },
  147 + { 180,14, 147,44, 436,104, 401,161, 366,219, 207,-10 },
  148 + { 400,367, 395,404, 71,406, 77,336, 82,265, 407,300 },
  149 + { 396,222, 396,316, 71,439, 70,245, 68,51, 396,132 },
  150 + { 342,109, 454,153, 49,332, 208,413, 367,494, 8,-23 },
  151 + { 147,167, 222,137, 266,169, 231,199, 197,229, 129,178 },
  152 + { 227,272, 310,243, 277,313, 322,266, 367,219, 207,313 },
  153 + { 279,192, 339,233, 396,211, 367,182, 338,152, 228,194 },
  154 + { 236,20, 283,75, 346,26, 338,71, 330,116, 207,17 },
  155 + { 129,83, 164,23, 158,14, 179,11, 200,8, 91,78 },
  156 + { 86,231, 129,293, 164,421, 104,348, 44,275, 66,200 },
  157 + { 193,328, 197,278, 240,348, 276,305, 311,263, 199,354 },
  158 + { 231,364, 241,209, 309,104, 326,236, 342,367, 225,424 },
  159 + { 414,230, 398,328, 446,445, 467,363, 489,281, 373,254 },
  160 + { 289,122, 332,123, 348,161, 322,158, 297,156, 275,125 },
  161 + { 142,235, 199,308, 402,229, 283,218, 164,206, 130,206 },
  162 + { 174,396, 210,387, 328,501, 246,455, 165,409, 138,394 },
  163 + { 288,388, 366,357, 372,458, 393,400, 414,343, 249,431 },
  164 + { 351,278, 409,369, 497,316, 437,288, 376,260, 351,243 },
  165 + { 87,134, 181,77, 311,121, 206,140, 101,160, 61,159 },
  166 + { 95,195, 126,208, 133,258, 110,236, 88,215, 95,195 },
  167 + { 140,293, 158,330, 169,275, 184,299, 198,323, 126,313 },
  168 + { 336,319, 383,357, 388,278, 393,333, 397,388, 311,325 },
  169 + { 338,107, 434,209, -37,469, 151,287, 338,104, 285,50 },
  170 + { 403,134, 446,182, 378,318, 386,233, 393,149, 360,98 },
  171 + { 366,82, 413,93, 416,158, 390,118, 364,78, 336,75 },
  172 + { 448,188, 448,230, 465,269, 470,225, 474,181, 448,177 },
  173 + { 121,398, 142,418, 126,475, 111,436, 96,396, 100,382 },
  174 + { 40,296, 90,352, 170,310, 143,350, 116,391, 7,300 },
  175 + { 25,203, 45,241, 70,204, 45,248, 19,293, 4,204 },
  176 + { 243,222, 225,275, 345,256, 296,237, 247,218, 249,199 },
  177 + { 159,149, 282,133, 284,199, 226,191, 169,184, 147,160 },
  178 + { 149,257, 290,322, 151,374, 166,338, 182,302, 116,263 },
  179 + { 255,285, 354,327, 234,287, 279,327, 323,367, 193,290 },
  180 + { 188,220, 353,190, 290,354, 348,293, 407,231, 152,248 },
  181 + { 305,122, 382,174, 402,229, 366,198, 329,167, 297,127 },
  182 + { 378,260, 406,267, 390,330, 384,293, 377,257, 366,263 },
  183 + { 178,396, 357,365, 273,461, 248,431, 223,401, 157,412 },
  184 + { 180,89, 258,88, 302,94, 255,115, 207,136, 166,96 },
  185 + { 81,197, 139,232, 39,257, 94,259, 150,261, 58,200 },
  186 + { 314,89, 378,40, 383,38, 389,42, 395,45, 267,90 },
  187 + { 371,141, 482,233, 508,244, 498,272, 488,299, 307,157 },
  188 + { 339,348, 361,465, 382,477, 406,442, 430,406, 269,369 }
  189 + };
  190 + const unsigned int NUM_PARTICLE( sizeof( PATHS ) / sizeof( PATHS[0] ) );
  191 +
  192 + const float PARTICLE_SIZE = 13.f;
  193 +
  194 + const float ACTOR_SCALE = 0.704f; // resize 500*500 to 352*352, a bit smaller than 360*360
  195 + const Vector3 ACTOR_POSITION( -176.f, -176.f, 1.f);
  196 +
  197 + const int MAXIMUM_ANIMATION_COUNT = 30;
  198 +
  199 + // Geometry format used by the SparkeEffect
  200 + struct Vertex
  201 + {
  202 + Vertex( const Vector2& texCoord,
  203 + const Vector2& aParticlePath0,
  204 + const Vector2& aParticlePath1,
  205 + const Vector2& aParticlePath2,
  206 + const Vector2& aParticlePath3,
  207 + const Vector2& aParticlePath4,
  208 + const Vector2& aParticlePath5 )
  209 + : aTexCoord( texCoord ),
  210 + aParticlePath0( aParticlePath0 ),
  211 + aParticlePath1( aParticlePath1 ),
  212 + aParticlePath2( aParticlePath2 ),
  213 + aParticlePath3( aParticlePath3 ),
  214 + aParticlePath4( aParticlePath4 ),
  215 + aParticlePath5( aParticlePath5 )
  216 + {
  217 + }
  218 +
  219 + Vector2 aTexCoord;
  220 + Vector2 aParticlePath0;
  221 + Vector2 aParticlePath1;
  222 + Vector2 aParticlePath2;
  223 + Vector2 aParticlePath3;
  224 + Vector2 aParticlePath4;
  225 + Vector2 aParticlePath5;
  226 + };
  227 +
  228 + /**
  229 + * Create a SparkleEffect object.
  230 + * @return A handle to a newly allocated SparkleEffect
  231 + */
  232 + Shader New()
  233 + {
  234 + std::string vertexShader = DALI_COMPOSE_SHADER(
  235 + precision highp float;\n
  236 + \n
  237 + attribute vec2 aTexCoord;\n
  238 + uniform mat4 uMvpMatrix;\n
  239 + varying vec2 vTexCoord;\n
  240 + \n
  241 + attribute vec2 aParticlePath0;\n
  242 + attribute vec2 aParticlePath1;\n
  243 + attribute vec2 aParticlePath2;\n
  244 + attribute vec2 aParticlePath3;\n
  245 + attribute vec2 aParticlePath4;\n
  246 + attribute vec2 aParticlePath5;\n
  247 + \n
  248 + uniform float uPercentage;\n
  249 + uniform float uPercentageMarked;\n
  250 + uniform vec3 uParticleColors[NUM_COLOR];\n
  251 + uniform float uOpacity[NUM_PARTICLE];\n
  252 + uniform vec2 uTapIndices;
  253 + uniform float uTapOffset[MAXIMUM_ANIMATION_COUNT];\n
  254 + uniform vec2 uTapPoint[MAXIMUM_ANIMATION_COUNT];\n
  255 + uniform float uAcceleration;\n
  256 + uniform float uRadius;\n
  257 + uniform float uScale;\n
  258 + uniform float uBreak;\n
  259 + \n
  260 + varying lowp vec4 vColor;\n
  261 + \n
  262 + void main()\n
  263 + {\n
  264 + // we store the particle index inside texCoord attribute
  265 + float idx = abs(aTexCoord.y)-1.0;\n
  266 + \n
  267 + // early out if the particle is invisible
  268 + if(uOpacity[int(idx)]<1e-5)\n
  269 + {\n
  270 + gl_Position = vec4(0.0);\n
  271 + vColor = vec4(0.0);\n
  272 + return;\n
  273 + }\n
  274 + \n
  275 + // As the movement along the b-curve has nonuniform speed with a uniform increasing parameter 'uPercentage'
  276 + // we give different particles the different 'percentage' to make them looks more random
  277 + float increment = idx / float(NUM_PARTICLE)*5.0;
  278 + float percentage = mod(uPercentage +uAcceleration+increment, 1.0);
  279 + \n
  280 + vec2 p0; vec2 p1; vec2 p2; vec2 p3;
  281 + // calculate the particle position by using the cubic b-curve equation
  282 + if(percentage<0.5)\n // particle on the first b-curve
  283 + {\n
  284 + p0 = aParticlePath0;\n
  285 + p1 = aParticlePath1;\n
  286 + p2 = aParticlePath2;\n
  287 + p3 = aParticlePath3;\n
  288 + }\n
  289 + else\n
  290 + {\n
  291 + p0 = aParticlePath3;\n
  292 + p1 = aParticlePath4;\n
  293 + p2 = aParticlePath5;\n
  294 + p3 = aParticlePath0;\n
  295 + }\n
  296 + float t = mod( percentage*2.0, 1.0);\n
  297 + vec2 position = (1.0-t)*(1.0-t)*(1.0-t)*p0 + 3.0*(1.0-t)*(1.0-t)*t*p1+3.0*(1.0-t)*t*t*p2 + t*t*t*p3;\n
  298 + \n
  299 + vec2 referencePoint = mix(p0,p3,0.5);\n
  300 + float maxAnimationCount = float(MAXIMUM_ANIMATION_COUNT);\n
  301 + \n
  302 + for( float i=uTapIndices.x; i<uTapIndices.y; i+=1.0 )\n
  303 + {
  304 + int id = int( mod(i+0.5,maxAnimationCount ) );\n
  305 + vec2 edgePoint = normalize(referencePoint-uTapPoint[id])*uRadius+vec2(uRadius);\n
  306 + position = mix( position, edgePoint, uTapOffset[id] ) ;\n
  307 + }\n
  308 + \n
  309 + position = mix( position, vec2( 250.0,250.0 ),uBreak*(1.0-uOpacity[int(idx)]) ) ;
  310 + \n
  311 + // vertex position on the mesh: (sign(aTexCoord.x), sign(aTexCoord.y))*PARTICLE_HALF_SIZE
  312 + gl_Position = uMvpMatrix * vec4( position.x+sign(aTexCoord.x)*PARTICLE_HALF_SIZE/uScale,
  313 + position.y+sign(aTexCoord.y)*PARTICLE_HALF_SIZE/uScale,
  314 + 0.0, 1.0 );\n
  315 + \n
  316 + // we store the color index inside texCoord attribute
  317 + float colorIndex = abs(aTexCoord.x);
  318 + vColor.rgb = uParticleColors[int(colorIndex)-1];\n
  319 + vColor.a = fract(colorIndex) * uOpacity[int(idx)];\n
  320 + \n
  321 + // produce a 'seemingly' random fade in/out
  322 + percentage = mod(uPercentage+increment+0.15, 1.0);\n
  323 + float ramdomOpacity = (min(percentage, 0.25)-0.15+0.9-max(percentage,0.9))*10.0;\n
  324 + vColor.a *=ramdomOpacity;\n
  325 + \n
  326 + vTexCoord = clamp(aTexCoord, 0.0, 1.0);\n
  327 + }\n
  328 + );
  329 +
  330 + std::string fragmentShader = DALI_COMPOSE_SHADER(
  331 + precision highp float;\n
  332 + uniform sampler2D sTexture;\n
  333 + varying vec2 vTexCoord;\n
  334 + \n
  335 + varying lowp vec4 vColor;\n
  336 + \n
  337 + void main()\n
  338 + {\n
  339 + gl_FragColor = vColor;\n
  340 + gl_FragColor.a *= texture2D(sTexture, vTexCoord).a;\n
  341 + }\n
  342 + );
  343 +
  344 + std::ostringstream vertexShaderStringStream;
  345 + vertexShaderStringStream<< "#define NUM_COLOR "<< NUM_COLOR << "\n"
  346 + << "#define NUM_PARTICLE "<< NUM_PARTICLE << "\n"
  347 + << "#define PARTICLE_HALF_SIZE "<< PARTICLE_SIZE*ACTOR_SCALE/2.f << "\n"
  348 + << "#define MAXIMUM_ANIMATION_COUNT "<<MAXIMUM_ANIMATION_COUNT<<"\n"
  349 + << vertexShader;
  350 +
  351 + Shader handle = Shader::New( vertexShaderStringStream.str(), fragmentShader );
  352 +
  353 + // set the particle colors
  354 + std::ostringstream oss;
  355 + for( unsigned int i = 0; i < NUM_COLOR; i++ )
  356 + {
  357 + oss.str("");
  358 + oss<< PARTICLE_COLOR_UNIFORM_NAME<< i << "]";
  359 + handle.RegisterProperty(oss.str(), PARTICLE_COLORS[i].RGB);
  360 + }
  361 + handle.RegisterProperty( "uRadius", 250.f );
  362 + handle.RegisterProperty( "uScale", ACTOR_SCALE );
  363 +
  364 + // set the initial uniform values
  365 +
  366 + for( unsigned int i = 0; i < NUM_PARTICLE; i++ )
  367 + {
  368 + oss.str("");
  369 + oss<< OPACITY_UNIFORM_NAME << i << "]";
  370 + handle.RegisterProperty(oss.str(), 1.f);
  371 + }
  372 + handle.RegisterProperty( PERCENTAGE_UNIFORM_NAME, 0.f );
  373 + handle.RegisterProperty( ACCELARATION_UNIFORM_NAME, 0.f );
  374 + handle.RegisterProperty( BREAK_UNIFORM_NAME, 0.f);
  375 + handle.RegisterProperty( TAP_INDICES_UNIFORM_NAME, Vector2::ZERO);
  376 +
  377 + for( int i = 0; i < MAXIMUM_ANIMATION_COUNT; i++ )
  378 + {
  379 + oss.str("");
  380 + oss<< TAP_OFFSET_UNIFORM_NAME << i << "]";
  381 + handle.RegisterProperty(oss.str(), 0.f);
  382 +
  383 + oss.str("");
  384 + oss<< TAP_POINT_UNIFORM_NAME << i << "]";
  385 + handle.RegisterProperty(oss.str(), Vector2( 250.0f,250.0f ));
  386 + }
  387 +
  388 + return handle;
  389 + }
  390 +
  391 +}; // namespace SparkleEffect
  392 +
  393 +#endif // DALI_SPARKLE_EFFECT_H
... ...
packaging/com.samsung.dali-demo.spec
... ... @@ -2,7 +2,7 @@
2 2  
3 3 Name: com.samsung.dali-demo
4 4 Summary: The OpenGLES Canvas Core Demo
5   -Version: 1.2.4
  5 +Version: 1.2.5
6 6 Release: 1
7 7 Group: System/Libraries
8 8 License: Apache-2.0
... ...
resources/images/sparkle_normal_background.png 0 → 100755

31.5 KB

resources/images/sparkle_particle.png 0 → 100755

1.07 KB

resources/po/as.po
... ... @@ -88,6 +88,9 @@ msgstr &quot;পৃষ্ঠা লেআউট&quot;
88 88 msgid "DALI_DEMO_STR_TITLE_POPUP"
89 89 msgstr "পোপা মেনু"
90 90  
  91 +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR"
  92 +msgstr "অগ্রগতি বার"
  93 +
91 94 msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES"
92 95 msgstr "অংশ্যমান অৰ্কিড"
93 96  
... ... @@ -106,6 +109,9 @@ msgstr &quot;লিপি&quot;
106 109 msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW"
107 110 msgstr "স্ক্ৰ'ল কৰক"
108 111  
  112 +msgid "DALI_DEMO_STR_TITLE_SPARKLE"
  113 +msgstr "তাৰকা"
  114 +
109 115 msgid "DALI_DEMO_STR_TITLE_STYLING"
110 116 msgstr "শৈলী"
111 117  
... ...
resources/po/de.po
... ... @@ -88,6 +88,9 @@ msgstr &quot;Seite wechseln&quot;
88 88 msgid "DALI_DEMO_STR_TITLE_POPUP"
89 89 msgstr "Popup-Menü"
90 90  
  91 +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR"
  92 +msgstr "Fortschrittsanzeige"
  93 +
91 94 msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES"
92 95 msgstr "Grundformen"
93 96  
... ... @@ -106,6 +109,9 @@ msgstr &quot;Scripting&quot;
106 109 msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW"
107 110 msgstr "Scroll-Ansicht"
108 111  
  112 +msgid "DALI_DEMO_STR_TITLE_SPARKLE"
  113 +msgstr "Funkeln"
  114 +
109 115 msgid "DALI_DEMO_STR_TITLE_STYLING"
110 116 msgstr "Styling"
111 117  
... ...
resources/po/en_GB.po
... ... @@ -88,6 +88,9 @@ msgstr &quot;Page Turn View&quot;
88 88 msgid "DALI_DEMO_STR_TITLE_POPUP"
89 89 msgstr "Popup"
90 90  
  91 +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR"
  92 +msgstr "Progress Bar"
  93 +
91 94 msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES"
92 95 msgstr "Primitive Shapes"
93 96  
... ... @@ -106,6 +109,9 @@ msgstr &quot;Script-based UI&quot;
106 109 msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW"
107 110 msgstr "Scroll View"
108 111  
  112 +msgid "DALI_DEMO_STR_TITLE_SPARKLE"
  113 +msgstr "Sparkle"
  114 +
109 115 msgid "DALI_DEMO_STR_TITLE_STYLING"
110 116 msgstr "Styling"
111 117  
... ...
resources/po/en_US.po
... ... @@ -88,6 +88,9 @@ msgstr &quot;Page Turn View&quot;
88 88 msgid "DALI_DEMO_STR_TITLE_POPUP"
89 89 msgstr "Popup"
90 90  
  91 +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR"
  92 +msgstr "Progress Bar"
  93 +
91 94 msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES"
92 95 msgstr "Primitive Shapes"
93 96  
... ... @@ -106,6 +109,9 @@ msgstr &quot;Script-based UI&quot;
106 109 msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW"
107 110 msgstr "Scroll View"
108 111  
  112 +msgid "DALI_DEMO_STR_TITLE_SPARKLE"
  113 +msgstr "Sparkle"
  114 +
109 115 msgid "DALI_DEMO_STR_TITLE_STYLING"
110 116 msgstr "Styling"
111 117  
... ...
resources/po/es.po
... ... @@ -88,6 +88,9 @@ msgstr &quot;Vista de páginas&quot;
88 88 msgid "DALI_DEMO_STR_TITLE_POPUP"
89 89 msgstr "Popup"
90 90  
  91 +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR"
  92 +msgstr "Barra de progreso"
  93 +
91 94 msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES"
92 95 msgstr "Primitvas 3D"
93 96  
... ... @@ -106,6 +109,9 @@ msgstr &quot;Interfaz definida por Script&quot;
106 109 msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW"
107 110 msgstr "Vista de desplazamiento"
108 111  
  112 +msgid "DALI_DEMO_STR_TITLE_SPARKLE"
  113 +msgstr "Brillar"
  114 +
109 115 msgid "DALI_DEMO_STR_TITLE_STYLING"
110 116 msgstr "Estilo"
111 117  
... ...
resources/po/ko.po
... ... @@ -88,6 +88,9 @@ msgstr &quot;책장 넘기기&quot;
88 88 msgid "DALI_DEMO_STR_TITLE_POPUP"
89 89 msgstr "팝업"
90 90  
  91 +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR"
  92 +msgstr "진행률 표시 줄"
  93 +
91 94 msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES"
92 95 msgstr "기본 모양"
93 96  
... ... @@ -106,6 +109,9 @@ msgstr &quot;스크립팅&quot;
106 109 msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW"
107 110 msgstr "스크롤 뷰"
108 111  
  112 +msgid "DALI_DEMO_STR_TITLE_SPARKLE"
  113 +msgstr "불꽃"
  114 +
109 115 msgid "DALI_DEMO_STR_TITLE_STYLING"
110 116 msgstr "스타일링"
111 117  
... ...
resources/po/ml.po
... ... @@ -88,6 +88,9 @@ msgstr &quot;പേജ് ലേഔട്ട്&quot;
88 88 msgid "DALI_DEMO_STR_TITLE_POPUP"
89 89 msgstr "പോപപ്പ് മെനുവിൽ"
90 90  
  91 +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR"
  92 +msgstr "പ്രോഗ്രസ് ബാർ"
  93 +
91 94 msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES"
92 95 msgstr "അടിസ്ഥാന രൂപങ്ങൾ"
93 96  
... ... @@ -106,6 +109,9 @@ msgstr &quot;സ്ക്രിപ്റ്റ്&quot;
106 109 msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW"
107 110 msgstr "സ്ക്രോള്ചെയ്യുക കാഴ്ച"
108 111  
  112 +msgid "DALI_DEMO_STR_TITLE_SPARKLE"
  113 +msgstr "നക്ഷത്ര"
  114 +
109 115 msgid "DALI_DEMO_STR_TITLE_STYLING"
110 116 msgstr "ശൈലി"
111 117  
... ... @@ -131,4 +137,4 @@ msgid &quot;DALI_DEMO_STR_TITLE_TEXT_SCROLLING&quot;
131 137 msgstr "ടെക്സ്റ്റ് സ്ക്രോളിംഗ്"
132 138  
133 139 msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR"
134   -msgstr "ചെരിവ് സെൻസർ"
135 140 \ No newline at end of file
  141 +msgstr "ചെരിവ് സെൻസർ"
... ...
resources/po/ur.po
... ... @@ -88,6 +88,9 @@ msgstr &quot;کتاب&quot;
88 88 msgid "DALI_DEMO_STR_TITLE_POPUP"
89 89 msgstr "پاپ اپ"
90 90  
  91 +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR"
  92 +msgstr "ترقی بار"
  93 +
91 94 msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES"
92 95 msgstr "سادہ ماڈلیے"
93 96  
... ... @@ -106,6 +109,9 @@ msgstr &quot;سکرپٹ&quot;
106 109 msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW"
107 110 msgstr "سکرول ویو"
108 111  
  112 +msgid "DALI_DEMO_STR_TITLE_SPARKLE"
  113 +msgstr "سٹار"
  114 +
109 115 msgid "DALI_DEMO_STR_TITLE_STYLING"
110 116 msgstr "سٹائل"
111 117  
... ...
resources/po/zn_CH.po
... ... @@ -88,6 +88,9 @@ msgstr &quot;翻页&quot;
88 88 msgid "DALI_DEMO_STR_TITLE_POPUP"
89 89 msgstr "弹窗"
90 90  
  91 +msgid "DALI_DEMO_STR_TITLE_PROGRESS_BAR"
  92 +msgstr "进度条"
  93 +
91 94 msgid "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES"
92 95 msgstr "基本形状"
93 96  
... ... @@ -106,6 +109,9 @@ msgstr &quot;脚本用户界面&quot;
106 109 msgid "DALI_DEMO_STR_TITLE_SCROLL_VIEW"
107 110 msgstr "滚动视图"
108 111  
  112 +msgid "DALI_DEMO_STR_TITLE_SPARKLE"
  113 +msgstr "火花"
  114 +
109 115 msgid "DALI_DEMO_STR_TITLE_STYLING"
110 116 msgstr "样式"
111 117  
... ... @@ -131,4 +137,4 @@ msgid &quot;DALI_DEMO_STR_TITLE_TEXT_SCROLLING&quot;
131 137 msgstr "滚动文字"
132 138  
133 139 msgid "DALI_DEMO_STR_TITLE_TILT_SENSOR"
134   -msgstr "倾斜传感器"
135 140 \ No newline at end of file
  141 +msgstr "倾斜传感器"
... ...
shared/dali-demo-strings.h
... ... @@ -16,8 +16,8 @@
16 16 */
17 17  
18 18 /* This header file includes all multi language strings which need display */
19   -#ifndef __DALI_DEMO_STRINGS_H__
20   -#define __DALI_DEMO_STRINGS_H__
  19 +#ifndef DALI_DEMO_STRINGS_H
  20 +#define DALI_DEMO_STRINGS_H
21 21  
22 22 #include <libintl.h>
23 23  
... ... @@ -62,12 +62,13 @@ extern &quot;C&quot;
62 62 #define DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_NEGOTIATE_SIZE")
63 63 #define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW")
64 64 #define DALI_DEMO_STR_TITLE_POPUP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_POPUP")
  65 +#define DALI_DEMO_STR_TITLE_PROGRESS_BAR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PROGRESS_BAR")
65 66 #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES")
66   -#define DALI_DEMO_STR_TITLE_RADIAL_MENU dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RADIAL_MENU")
67 67 #define DALI_DEMO_STR_TITLE_REFRACTION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_REFRACTION")
68 68 #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERER_STENCIL")
69 69 #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI")
70 70 #define DALI_DEMO_STR_TITLE_SCROLL_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCROLL_VIEW")
  71 +#define DALI_DEMO_STR_TITLE_SPARKLE dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SPARKLE")
71 72 #define DALI_DEMO_STR_TITLE_STYLING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_STYLING")
72 73 #define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM")
73 74 #define DALI_DEMO_STR_TITLE_TEXTURED_MESH dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_TEXTURED_MESH")
... ... @@ -111,11 +112,11 @@ extern &quot;C&quot;
111 112 #define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW "Page Turn View"
112 113 #define DALI_DEMO_STR_TITLE_POPUP "Popup"
113 114 #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes"
114   -#define DALI_DEMO_STR_TITLE_RADIAL_MENU "Radial Menu"
115 115 #define DALI_DEMO_STR_TITLE_REFRACTION "Refract Effect"
116 116 #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL "Renderer Stencils"
117 117 #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI "Script Based UI"
118 118 #define DALI_DEMO_STR_TITLE_SCROLL_VIEW "Scroll View"
  119 +#define DALI_DEMO_STR_TITLE_SPARKLE "Sparkle"
119 120 #define DALI_DEMO_STR_TITLE_STYLING "Styling"
120 121 #define DALI_DEMO_STR_TITLE_SUPER_BLUR_BLOOM "Super Blur and Bloom"
121 122 #define DALI_DEMO_STR_TITLE_TEXTURED_MESH "Mesh Texture"
... ... @@ -125,6 +126,7 @@ extern &quot;C&quot;
125 126 #define DALI_DEMO_STR_TITLE_TEXT_LABEL_MULTI_LANGUAGE "Text Scripts"
126 127 #define DALI_DEMO_STR_TITLE_TEXT_SCROLLING "Text Scrolling"
127 128 #define DALI_DEMO_STR_TITLE_TILT_SENSOR "Tilt Sensor"
  129 +#define DALI_DEMO_STR_TITLE_PROGRESS_BAR "Progress Bar"
128 130  
129 131 #endif
130 132  
... ... @@ -132,4 +134,4 @@ extern &quot;C&quot;
132 134 }
133 135 #endif // __cplusplus
134 136  
135   -#endif // __DALI_DEMO_STRINGS_H__
  137 +#endif // DALI_DEMO_STRINGS_H
... ...