Commit cdeb6c7dba4ea4f48398abd549480374c771a530
Committed by
Gerrit Code Review
Merge "Clipping API feature in Actor" into devel/master
Showing
10 changed files
with
8 additions
and
1127 deletions
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> | ... | ... |
demo/dali-demo.cpp
| ... | ... | @@ -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)); | ... | ... |
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-shaders.h
| ... | ... | @@ -29,7 +29,7 @@ const char * const POSITION( "aPosition"); |
| 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. | ... | ... |
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 | |
| ... | ... | @@ -64,7 +64,6 @@ extern "C" |
| 64 | 64 | #define DALI_DEMO_STR_TITLE_POPUP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_POPUP") |
| 65 | 65 | #define DALI_DEMO_STR_TITLE_PROGRESS_BAR dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PROGRESS_BAR") |
| 66 | 66 | #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES") |
| 67 | -#define DALI_DEMO_STR_TITLE_RADIAL_MENU dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RADIAL_MENU") | |
| 68 | 67 | #define DALI_DEMO_STR_TITLE_REFRACTION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_REFRACTION") |
| 69 | 68 | #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERER_STENCIL") |
| 70 | 69 | #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI") |
| ... | ... | @@ -113,7 +112,6 @@ extern "C" |
| 113 | 112 | #define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW "Page Turn View" |
| 114 | 113 | #define DALI_DEMO_STR_TITLE_POPUP "Popup" |
| 115 | 114 | #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes" |
| 116 | -#define DALI_DEMO_STR_TITLE_RADIAL_MENU "Radial Menu" | |
| 117 | 115 | #define DALI_DEMO_STR_TITLE_REFRACTION "Refract Effect" |
| 118 | 116 | #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL "Renderer Stencils" |
| 119 | 117 | #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI "Script Based UI" |
| ... | ... | @@ -136,4 +134,4 @@ extern "C" |
| 136 | 134 | } |
| 137 | 135 | #endif // __cplusplus |
| 138 | 136 | |
| 139 | -#endif // __DALI_DEMO_STRINGS_H__ | |
| 137 | +#endif // DALI_DEMO_STRINGS_H | ... | ... |