diff options
-rw-r--r-- | com.samsung.dali-demo.xml | 3 | ||||
-rw-r--r-- | demo/dali-demo.cpp | 1 | ||||
-rw-r--r-- | examples/radial-menu/radial-menu-example.cpp | 307 | ||||
-rw-r--r-- | examples/radial-menu/radial-sweep-view-impl.cpp | 357 | ||||
-rw-r--r-- | examples/radial-menu/radial-sweep-view-impl.h | 118 | ||||
-rw-r--r-- | examples/radial-menu/radial-sweep-view.cpp | 184 | ||||
-rw-r--r-- | examples/radial-menu/radial-sweep-view.h | 150 | ||||
-rw-r--r-- | examples/renderer-stencil/renderer-stencil-shaders.h | 5 | ||||
-rw-r--r-- | examples/size-negotiation/size-negotiation-example.cpp | 2 | ||||
-rw-r--r-- | shared/dali-demo-strings.h | 8 |
10 files changed, 8 insertions, 1127 deletions
diff --git a/com.samsung.dali-demo.xml b/com.samsung.dali-demo.xml index 4dbcc915..5c0b6af0 100644 --- a/com.samsung.dali-demo.xml +++ b/com.samsung.dali-demo.xml @@ -55,9 +55,6 @@ <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"> <label>Motion Stretch</label> </ui-application> - <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"> - <label>Radial Menu</label> - </ui-application> <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"> <label>Refraction effect</label> </ui-application> diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index 28b1082a..924d8f27 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -46,7 +46,6 @@ int DALI_EXPORT_API main(int argc, char **argv) demo.AddExample(Example("motion-blur.example", DALI_DEMO_STR_TITLE_MOTION_BLUR)); demo.AddExample(Example("motion-stretch.example", DALI_DEMO_STR_TITLE_MOTION_STRETCH)); demo.AddExample(Example("page-turn-view.example", DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW)); - demo.AddExample(Example("radial-menu.example", DALI_DEMO_STR_TITLE_RADIAL_MENU)); demo.AddExample(Example("refraction-effect.example", DALI_DEMO_STR_TITLE_REFRACTION)); demo.AddExample(Example("scroll-view.example", DALI_DEMO_STR_TITLE_SCROLL_VIEW)); demo.AddExample(Example("shadow-bone-lighting.example", DALI_DEMO_STR_TITLE_LIGHTS_AND_SHADOWS)); diff --git a/examples/radial-menu/radial-menu-example.cpp b/examples/radial-menu/radial-menu-example.cpp deleted file mode 100644 index 13be24af..00000000 --- a/examples/radial-menu/radial-menu-example.cpp +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include <dali/dali.h> -#include <dali-toolkit/dali-toolkit.h> -#include "shared/view.h" -#include "radial-sweep-view.h" -#include "radial-sweep-view-impl.h" - -using namespace Dali; -using namespace Dali::Toolkit; - -namespace -{ -const char* TEST_OUTER_RING_FILENAME = DEMO_IMAGE_DIR "layer2.png"; // Image to be masked -const char* TEST_INNER_RING_FILENAME = DEMO_IMAGE_DIR "layer1.png"; // Image to be masked -const char* TEST_MENU_FILENAME = DEMO_IMAGE_DIR "layer3.png"; // Image to be masked -const char* TEST_DIAL_FILENAME = DEMO_IMAGE_DIR "layer4.png"; // Image to be masked -const char* TOOLBAR_IMAGE( DEMO_IMAGE_DIR "top-bar.png" ); // Background for toolbar -const char* APPLICATION_TITLE( "Radial Menu" ); -const char * const PLAY_ICON( DEMO_IMAGE_DIR "icon-play.png" ); -const char * const PLAY_ICON_SELECTED( DEMO_IMAGE_DIR "icon-play-selected.png" ); -const char * const STOP_ICON( DEMO_IMAGE_DIR "icon-stop.png" ); -const char * const STOP_ICON_SELECTED( DEMO_IMAGE_DIR "icon-stop-selected.png" ); -} - - -/******************************************************************************** - * Application controller class - */ - -// This example shows how to create a mesh actor for use as a stencil buffer -class RadialMenuExample : public ConnectionTracker -{ -public: - /** - * Constructor - * @param[in] app The application handle - */ - RadialMenuExample(Application app); - - /** - * Destructor - */ - ~RadialMenuExample(); - -private: - - /** - * Initialization signal handler - all actor initialization should happen here - * @param[in] app The application handle - */ - void OnInit(Application& app); - - /** - * Create a sweep view with the given image and parameters - */ - RadialSweepView CreateSweepView( std::string imageName, Degree initial, Degree final ); - - /** - * Start the sweep animation on the menu - */ - void StartAnimation(); - - /** - * Play or pause the animation when the button is clicked - */ - bool OnButtonClicked( Toolkit::Button button ); - - /** - * Update the state flag and change the button icon when the animation is finished - */ - void OnAnimationFinished( Animation& source ); - - /** - * Main key event handler - * - * @param[in] event The key event to respond to - */ - void OnKeyEvent(const KeyEvent& event); - -private: // Member variables - enum AnimState - { - STOPPED, - PAUSED, - PLAYING - }; - - Application mApplication; ///< The application handle - Toolkit::Control mView; ///< The toolbar view - Layer mContents; ///< The toolbar contents pane - ImageView mImageView; ///< Image view shown by stencil mask - Animation mAnimation; - AnimState mAnimationState; - - Toolkit::PushButton mPlayStopButton; - ImageView mDialView; - RadialSweepView mRadialSweepView1; - RadialSweepView mRadialSweepView2; - RadialSweepView mRadialSweepView3; -}; - -RadialMenuExample::RadialMenuExample(Application app) -: mApplication( app ), - mAnimationState(STOPPED) -{ - // Connect to the Application's Init signal - app.InitSignal().Connect(this, &RadialMenuExample::OnInit); -} - -RadialMenuExample::~RadialMenuExample() -{ - // Nothing to do here; actor handles will clean up themselves. -} - -void RadialMenuExample::OnInit(Application& app) -{ - Stage stage = Dali::Stage::GetCurrent(); - - // The Init signal is received once (only) during the Application lifetime - stage.KeyEventSignal().Connect(this, &RadialMenuExample::OnKeyEvent); - - // Create toolbar & view - Toolkit::ToolBar toolBar; - mContents = DemoHelper::CreateView( mApplication, - mView, - toolBar, - "", - TOOLBAR_IMAGE, - APPLICATION_TITLE ); - - mPlayStopButton = Toolkit::PushButton::New(); - mPlayStopButton.SetUnselectedImage( STOP_ICON ); - mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED ); - - mPlayStopButton.ClickedSignal().Connect( this, &RadialMenuExample::OnButtonClicked ); - - toolBar.AddControl( mPlayStopButton, - DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, - Toolkit::Alignment::HorizontalRight, - DemoHelper::DEFAULT_PLAY_PADDING ); - - - const ImageDimensions intImgSize = ResourceImage::GetImageSize(TEST_OUTER_RING_FILENAME); - Vector2 imgSize = Vector2( intImgSize.GetWidth(), intImgSize.GetHeight() ); - Vector2 stageSize = stage.GetSize(); - float scale = stageSize.width / imgSize.width; - float availableHeight = stageSize.height - DemoHelper::DEFAULT_VIEW_STYLE.mToolBarHeight * 2.0f; - if(availableHeight <= stageSize.width) - { - scale = availableHeight / imgSize.width; - } - - mRadialSweepView1 = CreateSweepView( TEST_OUTER_RING_FILENAME, Degree(-90.0f), Degree(-90.0f)); - mRadialSweepView2 = CreateSweepView( TEST_INNER_RING_FILENAME, Degree(90.0f), Degree(0.0f)); - mRadialSweepView3 = CreateSweepView( TEST_MENU_FILENAME, Degree(100.0f), Degree(0.0f)); - mRadialSweepView3.SetInitialActorAngle(Degree(-110)); - mRadialSweepView3.SetFinalActorAngle(Degree(0)); - - mDialView = ImageView::New( TEST_DIAL_FILENAME ); - mDialView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - mDialView.SetParentOrigin( ParentOrigin::CENTER ); - mDialView.SetScale(scale); - Layer dialLayer = Layer::New(); - - dialLayer.Add( mDialView ); - dialLayer.SetParentOrigin( ParentOrigin::CENTER ); - dialLayer.SetSize(stage.GetSize()); - mContents.Add(dialLayer); - - mRadialSweepView1.SetScale(scale); - mRadialSweepView2.SetScale(scale); - mRadialSweepView3.SetScale(scale); - - StartAnimation(); -} - -void RadialMenuExample::StartAnimation() -{ - mDialView.SetOpacity(0.0f); - mRadialSweepView1.SetOpacity(0.0f); - mAnimation = Animation::New(6.0f); - mRadialSweepView1.Activate(mAnimation, 0.0f, 3.0f); - mRadialSweepView2.Activate(mAnimation, 1.5f, 3.0f); - mRadialSweepView3.Activate(mAnimation, 3.0f, 3.0f); - mAnimation.AnimateTo( Property( mDialView, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::EASE_IN, TimePeriod( 0.0f, 0.8f ) ); - mAnimation.AnimateTo( Property( mRadialSweepView1, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::EASE_IN, TimePeriod( 0.0f, 0.5f ) ); - mAnimation.FinishedSignal().Connect( this, &RadialMenuExample::OnAnimationFinished ); - - mAnimationState = PLAYING; - mAnimation.Play(); -} - -bool RadialMenuExample::OnButtonClicked( Toolkit::Button button ) -{ - switch( mAnimationState ) - { - case PLAYING: - { - mAnimation.Pause(); - mAnimationState = PAUSED; - mPlayStopButton.SetUnselectedImage( PLAY_ICON ); - mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED ); - } - break; - - case PAUSED: - { - mAnimation.Play(); - mAnimationState = PLAYING; - mPlayStopButton.SetUnselectedImage( STOP_ICON ); - mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED ); - } - break; - - case STOPPED: - { - mPlayStopButton.SetUnselectedImage( STOP_ICON ); - mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED ); - mRadialSweepView1.Deactivate(); - mRadialSweepView2.Deactivate(); - mRadialSweepView3.Deactivate(); - StartAnimation(); - } - } - return false; -} - -void RadialMenuExample::OnAnimationFinished( Animation& source ) -{ - mAnimationState = STOPPED; - mPlayStopButton.SetUnselectedImage( PLAY_ICON ); - mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED ); -} - -RadialSweepView RadialMenuExample::CreateSweepView( std::string imageName, - Degree initialAngle, - Degree finalAngle) -{ - // Create the image - mImageView = ImageView::New(imageName); - mImageView.SetParentOrigin(ParentOrigin::CENTER); - mImageView.SetAnchorPoint(AnchorPoint::CENTER); - mImageView.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - - // Create the stencil - const ImageDimensions imageSize = ResourceImage::GetImageSize(imageName); - float diameter = std::max(imageSize.GetWidth(), imageSize.GetHeight()); - RadialSweepView radialSweepView = RadialSweepView::New(); - radialSweepView.SetDiameter( diameter ); - radialSweepView.SetInitialAngle( initialAngle ); - radialSweepView.SetFinalAngle( finalAngle ); - radialSweepView.SetInitialSector( Degree(0.0f) ); - radialSweepView.SetFinalSector( Degree(359.999f) ); - radialSweepView.SetSize( Stage::GetCurrent().GetSize()); - radialSweepView.SetEasingFunction( Dali::AlphaFunction::EASE_IN_OUT ); - radialSweepView.SetParentOrigin( ParentOrigin::CENTER ); - mContents.Add(radialSweepView); - radialSweepView.Add( mImageView ); - mImageView.SetParentOrigin( ParentOrigin::CENTER ); - - return radialSweepView; -} - - -void RadialMenuExample::OnKeyEvent(const KeyEvent& event) -{ - if(event.state == KeyEvent::Down) - { - if( IsKey( event, Dali::DALI_KEY_ESCAPE) || IsKey( event, Dali::DALI_KEY_BACK) ) - { - mApplication.Quit(); - } - } -} - -void RunTest(Application app) -{ - RadialMenuExample test(app); - - app.MainLoop(); -} - -// Entry point for Linux & Tizen applications -int DALI_EXPORT_API main(int argc, char **argv) -{ - Application app = Application::New(&argc, &argv, DEMO_THEME_PATH); - - RunTest(app); - - return 0; -} diff --git a/examples/radial-menu/radial-sweep-view-impl.cpp b/examples/radial-menu/radial-sweep-view-impl.cpp deleted file mode 100644 index 34bbe7ce..00000000 --- a/examples/radial-menu/radial-sweep-view-impl.cpp +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "radial-sweep-view-impl.h" - -#include <dali/public-api/rendering/renderer.h> -#include <sstream> - -using namespace Dali; - -namespace -{ - -const char* VERTEX_SHADER_PREFIX( "#define MATH_PI_2 1.570796\n#define MATH_PI_4 0.785398\n" ); - -const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( -attribute mediump float aAngleIndex;\n -attribute mediump vec2 aPosition1;\n -attribute mediump vec2 aPosition2;\n -uniform mediump mat4 uMvpMatrix;\n -uniform mediump float uStartAngle;\n -uniform mediump float uRotationAngle;\n -\n -void main()\n -{\n - float currentAngle = uStartAngle + uRotationAngle;\n - float angleInterval1 = MATH_PI_4 * aAngleIndex;\n - vec4 vertexPosition = vec4(0.0, 0.0, 0.0, 1.0);\n - if( currentAngle >= angleInterval1)\n - {\n - float angleInterval2 = angleInterval1 + MATH_PI_2;\n - float angle = currentAngle < angleInterval2 ? currentAngle : angleInterval2;\n - float delta;\n - if( mod( aAngleIndex+4.0, 4.0) < 2.0 )\n - {\n - delta = 0.5 - 0.5*cos(angle) / sin(angle);\n - }\n - else\n - {\n - delta = 0.5 + 0.5*sin(angle) / cos(angle);\n - }\n - vertexPosition.xy = mix( aPosition1, aPosition2, delta );\n - }\n - gl_Position = uMvpMatrix * vertexPosition;\n -} -); - -const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( -uniform lowp vec4 uColor;\n -\n -void main()\n -{\n - gl_FragColor = uColor;\n -}\n -); - -float HoldZeroFastEaseInOutHoldOne(float progress) -{ - if( progress < 0.2f) - { - return 0.0f; - } - else if(progress < 0.5f) - { - progress = (progress-0.2) / 0.3f; - return progress*progress*progress*0.5f; - } - else if(progress < 0.8f) - { - progress = ((progress - 0.5f) / 0.3f) - 1.0f; - return (progress*progress*progress+1.0f) * 0.5f + 0.5f; - } - else - { - return 1.0f; - } -} - -} // anonymous namespace - - -RadialSweepView RadialSweepViewImpl::New( ) -{ - return New( 2.0f, 100.0f, ANGLE_0, ANGLE_0, ANGLE_0, ANGLE_360 ); -} - - -RadialSweepView RadialSweepViewImpl::New( float duration, float diameter, Radian initialAngle, Radian finalAngle, Radian initialSector, Radian finalSector ) -{ - RadialSweepViewImpl* impl= new RadialSweepViewImpl(duration, diameter, initialAngle, finalAngle, initialSector, finalSector); - RadialSweepView handle = RadialSweepView(*impl); - return handle; -} - -RadialSweepViewImpl::RadialSweepViewImpl( float duration, float diameter, Radian initialAngle, Radian finalAngle, Radian initialSector, Radian finalSector ) -: Control( ControlBehaviour( ACTOR_BEHAVIOUR_NONE ) ), - mDuration(duration), - mDiameter(diameter), - mInitialAngle(initialAngle), - mFinalAngle(finalAngle), - mInitialSector(initialSector), - mFinalSector(finalSector), - mInitialActorAngle(0), - mFinalActorAngle(0), - mEasingFunction(HoldZeroFastEaseInOutHoldOne), - mStartAngleIndex(Property::INVALID_INDEX), - mRotationAngleIndex(Property::INVALID_INDEX), - mRotateActorsWithStencil(false), - mRotateActors(false) -{ -} - -void RadialSweepViewImpl::SetDuration(float duration) -{ - mDuration = duration; -} - -void RadialSweepViewImpl::SetEasingFunction( Dali::AlphaFunction easingFunction ) -{ - mEasingFunction = easingFunction; -} - -void RadialSweepViewImpl::SetDiameter(float diameter) -{ - mDiameter = diameter; -} - -void RadialSweepViewImpl::SetInitialAngle( Dali::Radian initialAngle) -{ - mInitialAngle = initialAngle; -} - -void RadialSweepViewImpl::SetFinalAngle( Dali::Radian finalAngle) -{ - mFinalAngle = finalAngle; -} - -void RadialSweepViewImpl::SetInitialSector( Dali::Radian initialSector) -{ - mInitialSector = initialSector; -} - -void RadialSweepViewImpl::SetFinalSector( Dali::Radian finalSector) -{ - mFinalSector = finalSector; -} - -void RadialSweepViewImpl::SetInitialActorAngle( Dali::Radian initialAngle ) -{ - mInitialActorAngle = initialAngle; - mRotateActors = true; -} - -void RadialSweepViewImpl::SetFinalActorAngle( Dali::Radian finalAngle ) -{ - mFinalActorAngle = finalAngle; - mRotateActors = true; -} - -float RadialSweepViewImpl::GetDuration( ) -{ - return mDuration; -} - -float RadialSweepViewImpl::GetDiameter( ) -{ - return mDiameter; -} - -Dali::Radian RadialSweepViewImpl::GetInitialAngle( ) -{ - return mInitialAngle; -} - -Dali::Radian RadialSweepViewImpl::GetFinalAngle( ) -{ - return mFinalAngle; -} - -Dali::Radian RadialSweepViewImpl::GetInitialSector( ) -{ - return mInitialSector; -} - -Dali::Radian RadialSweepViewImpl::GetFinalSector( ) -{ - return mFinalSector; -} - -Dali::Radian RadialSweepViewImpl::GetInitialActorAngle( ) -{ - return mInitialActorAngle; -} - -Dali::Radian RadialSweepViewImpl::GetFinalActorAngle( ) -{ - return mFinalActorAngle; -} - -void RadialSweepViewImpl::RotateActorsWithStencil(bool rotate) -{ - mRotateActorsWithStencil = rotate; -} - -void RadialSweepViewImpl::Add(Actor actor) -{ - if( ! mLayer ) - { - mLayer = Layer::New(); - Self().Add(mLayer); - mLayer.SetSize( Stage::GetCurrent().GetSize() ); - mLayer.SetParentOrigin( ParentOrigin::CENTER ); - } - - mLayer.Add(actor); -} - -void RadialSweepViewImpl::Activate( Animation anim, float offsetTime, float duration ) -{ - bool startAnimation=false; - if( ! anim ) - { - mAnim = Animation::New( mDuration ); - anim = mAnim; - startAnimation = true; - } - - if( ! mStencilActor ) - { - CreateStencil( mInitialSector ); - mLayer.Add( mStencilActor ); - mStencilActor.SetScale(mDiameter); - } - - mStencilActor.SetOrientation( mInitialAngle, Vector3::ZAXIS ); - mStencilActor.SetProperty( mRotationAngleIndex, mInitialSector.radian ); - - if( mRotateActors ) - { - for(unsigned int i=0, count=mLayer.GetChildCount(); i<count; i++) - { - Actor actor = mLayer.GetChildAt(i); - if( actor != mStencilActor ) - { - anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( mInitialActorAngle ), Vector3::ZAXIS ) ); - } - } - } - - anim.AnimateTo( Property( mStencilActor, mRotationAngleIndex ), mFinalSector.radian, mEasingFunction, TimePeriod( offsetTime, duration ) ); - anim.AnimateTo( Property( mStencilActor, Actor::Property::ORIENTATION ), Quaternion( Radian( mFinalAngle ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) ); - - if( mRotateActorsWithStencil ) - { - for(unsigned int i=0, count=mLayer.GetChildCount(); i<count; i++) - { - Actor actor = mLayer.GetChildAt(i); - if( actor != mStencilActor ) - { - anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( mFinalAngle.radian - mInitialAngle.radian ) , Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) ); - } - } - } - else if( mRotateActors ) - { - for(unsigned int i=0, count=mLayer.GetChildCount(); i<count; i++) - { - Actor actor = mLayer.GetChildAt(i); - if( actor != mStencilActor ) - { - anim.AnimateTo( Property( actor, Actor::Property::ORIENTATION ), Quaternion( Radian( mFinalActorAngle ), Vector3::ZAXIS ), mEasingFunction, TimePeriod( offsetTime, duration ) ); - } - } - } - - - if( startAnimation ) - { - anim.SetLooping(true); - anim.Play(); - } -} - - -void RadialSweepViewImpl::Deactivate() -{ - if( mAnim ) - { - mAnim.Stop(); - } -} - -void RadialSweepViewImpl::CreateStencil( Radian initialSector ) -{ - // Create the stencil mesh geometry - // 3-----2 - // | \ / | - // | 0--1 , 6 - // | / \ | - // 4-----5 - - struct VertexPosition { float angleIndex; Vector2 position1; Vector2 position2; }; - VertexPosition vertexData[7] = { // With X coordinate inverted to make the animation go anti clockwise from left center - { 9.f, Vector2( 0.f, 0.f ), Vector2( 0.f, 0.f ) }, // center point, keep static - { 0.f, Vector2( -0.5f, 0.f ), Vector2( -0.5f, 0.f ) }, // vertex 1, 0 degree, keep static - { -1.f, Vector2( -0.5f, 0.5f ), Vector2( -0.5f, -0.5f ) }, // -45 ~ 45 degrees ( 0 ~ 45) - { 1.f, Vector2( -0.5f, -0.5f ), Vector2( 0.5f, -0.5f ) }, // 45 ~ 135 degrees - { 3.f, Vector2( 0.5f, -0.5f ), Vector2( 0.5f, 0.5f ) }, // 135 ~ 225 degrees - { 5.f, Vector2( 0.5f, 0.5f ), Vector2( -0.5f, 0.5f ) }, // 225 ~ 315 degrees - { 7.f, Vector2( -0.5f, 0.5f ), Vector2( -0.5f, -0.5f ) } // 315 ~ 405 degrees ( 315 ~ 359.999 ) - }; - Property::Map vertexFormat; - vertexFormat["aAngleIndex"] = Property::FLOAT; - vertexFormat["aPosition1"] = Property::VECTOR2; - vertexFormat["aPosition2"] = Property::VECTOR2; - PropertyBuffer vertices = PropertyBuffer::New( vertexFormat ); - vertices.SetData( vertexData, 7u ); - - unsigned short indexData[15] = { 0,1,2,0,2,3,0,3,4,0,4,5,0,5,6 }; - - Geometry meshGeometry = Geometry::New(); - meshGeometry.AddVertexBuffer( vertices ); - meshGeometry.SetIndexBuffer( &indexData[0], sizeof( indexData )/sizeof(indexData[0]) ); - - // Create shader - std::ostringstream vertexShaderStringStream; - vertexShaderStringStream<<VERTEX_SHADER_PREFIX<<VERTEX_SHADER; - Shader shader = Shader::New( vertexShaderStringStream.str(), FRAGMENT_SHADER ); - - // Create renderer - Renderer renderer = Renderer::New( meshGeometry, shader ); - - mStencilActor = Actor::New(); - mStencilActor.AddRenderer( renderer ); - mStencilActor.SetSize(1.f, 1.f); - - // register properties - mStartAngleIndex = mStencilActor.RegisterProperty("uStartAngle", 0.f); - mRotationAngleIndex = mStencilActor.RegisterProperty("uRotationAngle", initialSector.radian); - - mStencilActor.SetDrawMode( DrawMode::STENCIL ); - mStencilActor.SetParentOrigin( ParentOrigin::CENTER ); -} diff --git a/examples/radial-menu/radial-sweep-view-impl.h b/examples/radial-menu/radial-sweep-view-impl.h deleted file mode 100644 index 5089c785..00000000 --- a/examples/radial-menu/radial-sweep-view-impl.h +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef DALI_DEMO_RADIAL_SWEEP_VIEW_IMPL_H -#define DALI_DEMO_RADIAL_SWEEP_VIEW_IMPL_H - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include <dali-toolkit/dali-toolkit.h> -#include "radial-sweep-view.h" - - -/******************************************************************************** - * Class to implement a layer with a radial sweep stencil mask and an actor tree - */ -class RadialSweepViewImpl : public Dali::Toolkit::Internal::Control -{ -public: - static RadialSweepView New(); - - static RadialSweepView New( float duration, - float diameter, - Dali::Radian initialAngle, - Dali::Radian finalAngle, - Dali::Radian initialSector, - Dali::Radian finalSector ); - - RadialSweepViewImpl( float duration, - float diameter, - Dali::Radian initialAngle, - Dali::Radian finalAngle, - Dali::Radian initialSector, - Dali::Radian finalSector ); - - void SetDuration(float duration); - void SetEasingFunction( Dali::AlphaFunction easingFunction ); - - void SetDiameter(float diameter); - void SetInitialAngle( Dali::Radian initialAngle); - void SetFinalAngle( Dali::Radian finalAngle); - void SetInitialSector( Dali::Radian initialSector); - void SetFinalSector( Dali::Radian finalSector); - void SetInitialActorAngle( Dali::Radian initialAngle ); - void SetFinalActorAngle( Dali::Radian finalAngle ); - - float GetDuration( ); - float GetDiameter( ); - Dali::Radian GetInitialAngle( ); - Dali::Radian GetFinalAngle( ); - Dali::Radian GetInitialSector( ); - Dali::Radian GetFinalSector( ); - Dali::Radian GetInitialActorAngle( ); - Dali::Radian GetFinalActorAngle( ); - - void RotateActorsWithStencil(bool rotate); - - void Add( Dali::Actor actor ); - - void Activate( Dali::Animation anim = Dali::Animation(), float offsetTime=0, float duration=2.0f ); - - void Deactivate(); - -private: - - /** - * Create the stencil mask - */ - void CreateStencil(Dali::Radian initialSector ); - -private: - Dali::Layer mLayer; - Dali::Animation mAnim; - float mDuration; - float mDiameter; - Dali::Radian mInitialAngle; - Dali::Radian mFinalAngle; - Dali::Radian mInitialSector; - Dali::Radian mFinalSector; - Dali::Radian mInitialActorAngle; - Dali::Radian mFinalActorAngle; - Dali::AlphaFunction mEasingFunction; - Dali::Actor mStencilActor; ///< Stencil actor which generates mask - Dali::Property::Index mStartAngleIndex; ///< Index of start-angle property - Dali::Property::Index mRotationAngleIndex; ///< Index of rotation-angle property - bool mRotateActorsWithStencil:1; - bool mRotateActors; -}; - - -inline RadialSweepViewImpl& GetImpl( RadialSweepView& obj ) -{ - DALI_ASSERT_ALWAYS(obj); - Dali::RefObject& handle = obj.GetImplementation(); - return static_cast<RadialSweepViewImpl&>(handle); -} - -inline const RadialSweepViewImpl& GetImpl( const RadialSweepView& obj ) -{ - DALI_ASSERT_ALWAYS(obj); - const Dali::RefObject& handle = obj.GetImplementation(); - return static_cast<const RadialSweepViewImpl&>(handle); -} - - - -#endif // DALI_DEMO_RADIAL_SWEEP_VIEW_IMPL_H diff --git a/examples/radial-menu/radial-sweep-view.cpp b/examples/radial-menu/radial-sweep-view.cpp deleted file mode 100644 index 46e26099..00000000 --- a/examples/radial-menu/radial-sweep-view.cpp +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "radial-sweep-view.h" -#include "radial-sweep-view-impl.h" - -using namespace Dali; - -RadialSweepView::RadialSweepView() -{ -} - -RadialSweepView::RadialSweepView(const RadialSweepView& handle) -: Control(handle) -{ -} - -RadialSweepView& RadialSweepView::operator=(const RadialSweepView& rhs) -{ - if( &rhs != this ) - { - Control::operator=(rhs); - } - return *this; -} - -RadialSweepView::~RadialSweepView() -{ -} - -RadialSweepView RadialSweepView::DownCast( BaseHandle handle ) -{ - return Control::DownCast<RadialSweepView, RadialSweepViewImpl>(handle); -} - -RadialSweepView RadialSweepView::New( ) -{ - return RadialSweepViewImpl::New(); -} - -RadialSweepView RadialSweepView::New( float duration, - float diameter, - Radian initialAngle, - Radian finalAngle, - Radian initialSector, - Radian finalSector ) -{ - return RadialSweepViewImpl::New(duration, diameter, initialAngle, finalAngle, initialSector, finalSector ); -} - -RadialSweepView::RadialSweepView( RadialSweepViewImpl& impl ) -: Control( impl ) -{ -} - -RadialSweepView::RadialSweepView( Dali::Internal::CustomActor* impl ) -: Control( impl ) -{ - VerifyCustomActorPointer<RadialSweepViewImpl>(impl); -} - -void RadialSweepView::SetDuration(float duration) -{ - GetImpl(*this).SetDuration(duration); -} - -void RadialSweepView::SetEasingFunction( Dali::AlphaFunction easingFunction ) -{ - GetImpl(*this).SetEasingFunction( easingFunction ); -} - -void RadialSweepView::SetDiameter(float diameter) -{ - GetImpl(*this).SetDiameter(diameter); -} - -void RadialSweepView::SetInitialAngle( Dali::Radian initialAngle) -{ - GetImpl(*this).SetInitialAngle(initialAngle); -} - -void RadialSweepView::SetFinalAngle( Dali::Radian finalAngle) -{ - GetImpl(*this).SetFinalAngle(finalAngle); -} - -void RadialSweepView::SetInitialSector( Dali::Radian initialSector) -{ - GetImpl(*this).SetInitialSector(initialSector); -} - -void RadialSweepView::SetFinalSector( Dali::Radian finalSector) -{ - GetImpl(*this).SetFinalSector(finalSector); -} - -void RadialSweepView::SetInitialActorAngle( Dali::Radian initialAngle ) -{ - GetImpl(*this).SetInitialActorAngle(initialAngle); -} - -void RadialSweepView::SetFinalActorAngle( Dali::Radian finalAngle ) -{ - GetImpl(*this).SetFinalActorAngle(finalAngle); -} - -float RadialSweepView::GetDuration( ) -{ - return GetImpl(*this).GetDuration(); -} - -float RadialSweepView::GetDiameter( ) -{ - return GetImpl(*this).GetDiameter(); -} - -Dali::Radian RadialSweepView::GetInitialAngle( ) -{ - return GetImpl(*this).GetInitialAngle(); -} - -Dali::Radian RadialSweepView::GetFinalAngle( ) -{ - return GetImpl(*this).GetFinalAngle(); -} - -Dali::Radian RadialSweepView::GetInitialSector( ) -{ - return GetImpl(*this).GetInitialSector(); -} - -Dali::Radian RadialSweepView::GetFinalSector( ) -{ - return GetImpl(*this).GetFinalSector(); -} - -Dali::Radian RadialSweepView::GetInitialActorAngle( ) -{ - return GetImpl(*this).GetInitialActorAngle(); -} - -Dali::Radian RadialSweepView::GetFinalActorAngle( ) -{ - return GetImpl(*this).GetFinalActorAngle(); -} - -void RadialSweepView::RotateActorsWithStencil(bool rotate) -{ - GetImpl(*this).RotateActorsWithStencil(rotate); -} - -void RadialSweepView::Add(Actor actor) -{ - GetImpl(*this).Add(actor); -} - -void RadialSweepView::Activate() -{ - GetImpl(*this).Activate(); -} - -void RadialSweepView::Activate( Dali::Animation anim, float offsetTime, float duration ) -{ - GetImpl(*this).Activate(anim, offsetTime, duration); -} - -void RadialSweepView::Deactivate() -{ - GetImpl(*this).Deactivate(); -} diff --git a/examples/radial-menu/radial-sweep-view.h b/examples/radial-menu/radial-sweep-view.h deleted file mode 100644 index 3abdcb0d..00000000 --- a/examples/radial-menu/radial-sweep-view.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef DALI_DEMO_RADIAL_SWEEP_VIEW_H -#define DALI_DEMO_RADIAL_SWEEP_VIEW_H - -/* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include <dali-toolkit/dali-toolkit.h> - -class RadialSweepViewImpl; - - -/******************************************************************************** - * Handle to RadialSweepView implementation - */ -class RadialSweepView : public Dali::Toolkit::Control -{ -public: - /** - * Create a new RadialSweepView with default parameters (2 second animation, - * no rotation, sweeping out a full circle). - */ - static RadialSweepView New( ); - - /** - * Create a new RadialSweepView. - * @param[in] duration The duration of the sweep animation - * @param[in] diameter The diameter of the stencil mask - * @param[in] initialAngle The initial angle of the anticlockwise line of the sweep sector - * @param[in] finalAngle The final angle of the anticlockwise line of the sweep sector - * @param[in] initialSector The angle of the starting sector - * @param[in] finalSector The angle of the sector at the end of the animation. - * Note, to cover the entire circle, use a value of 359.9999 degrees, not zero or 360 degrees. - * - * initial sector - * \ | . - * \ | . - * initialAngle \ | . final sector - * \| _| - * .________ - */ - static RadialSweepView New( float duration, - float diameter, - Dali::Radian initialAngle, - Dali::Radian finalAngle, - Dali::Radian initialSector, - Dali::Radian finalSector ); - - void SetDuration(float duration); - - void SetEasingFunction( Dali::AlphaFunction easingFunction ); - - void SetDiameter(float diameter); - - void SetInitialAngle( Dali::Radian initialAngle); - - void SetFinalAngle( Dali::Radian finalAngle); - - void SetInitialSector( Dali::Radian initialSector); - - void SetFinalSector( Dali::Radian finalSector); - - void SetInitialActorAngle( Dali::Radian initialAngle ); - - void SetFinalActorAngle( Dali::Radian finalAngle ); - - float GetDuration( ); - - float GetDiameter( ); - - Dali::Radian GetInitialAngle( ); - - Dali::Radian GetFinalAngle( ); - - Dali::Radian GetInitialSector( ); - - Dali::Radian GetFinalSector( ); - - Dali::Radian GetInitialActorAngle( ); - - Dali::Radian GetFinalActorAngle( ); - - /** - * @param[in] rotate True if the actors should rotate with the stencil - */ - void RotateActorsWithStencil(bool rotate); - - /** - * Add actors to the view - */ - void Add(Actor actor); - - /** - * Activate the sweep animation - */ - void Activate( ); - - void Activate( Dali::Animation anim, float offsetTime, float duration ); - - /** - * Deactivate the sweep animation - */ - void Deactivate(); - - /** - * Default constructor. Create an uninitialized handle. - */ - RadialSweepView(); - - /** - * Copy constructor - */ - RadialSweepView(const RadialSweepView& handle); - - /** - * Assignment operator - */ - RadialSweepView& operator=(const RadialSweepView& rhs); - - /** - * Destructor - */ - ~RadialSweepView(); - - /** - * Downcast method - */ - static RadialSweepView DownCast( BaseHandle handle ); - -public: // Not for use by application developers - - RadialSweepView( RadialSweepViewImpl& impl ); - - RadialSweepView( Dali::Internal::CustomActor* impl ); -}; - -#endif diff --git a/examples/renderer-stencil/renderer-stencil-shaders.h b/examples/renderer-stencil/renderer-stencil-shaders.h index fe9c461b..fcf758f3 100644 --- a/examples/renderer-stencil/renderer-stencil-shaders.h +++ b/examples/renderer-stencil/renderer-stencil-shaders.h @@ -29,7 +29,7 @@ const char * const POSITION( "aPosition"); const char * const NORMAL( "aNormal" ); const char * const TEXTURE( "aTexCoord" ); -// Shader for todor (vertex): +// Shader for basic, per-vertex lighting (vertex): const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( attribute mediump vec3 aPosition; attribute highp vec3 aNormal; @@ -62,6 +62,7 @@ const char* VERTEX_SHADER = DALI_COMPOSE_SHADER( } ); +// Fragment shader. const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( varying mediump vec2 vTexCoord; varying mediump vec3 vIllumination; @@ -74,6 +75,7 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( } ); +// Shader for basic, per-vertex lighting with texture (vertex): const char* VERTEX_SHADER_TEXTURED = DALI_COMPOSE_SHADER( attribute mediump vec3 aPosition; attribute highp vec3 aNormal; @@ -107,6 +109,7 @@ const char* VERTEX_SHADER_TEXTURED = DALI_COMPOSE_SHADER( } ); +// Fragment shader. const char* FRAGMENT_SHADER_TEXTURED = DALI_COMPOSE_SHADER( varying mediump vec2 vTexCoord; varying mediump vec3 vIllumination; diff --git a/examples/size-negotiation/size-negotiation-example.cpp b/examples/size-negotiation/size-negotiation-example.cpp index 3c05fbd2..5fe5daa6 100644 --- a/examples/size-negotiation/size-negotiation-example.cpp +++ b/examples/size-negotiation/size-negotiation-example.cpp @@ -798,7 +798,7 @@ private: Layer mContentLayer; ///< Content layer. Toolkit::TextLabel mTitleActor; ///< Title text. - Toolkit::Popup mMenu; ///< The navigation menu todor. + Toolkit::Popup mMenu; ///< The navigation menu. Toolkit::Popup mPopup; ///< The current example popup. Toolkit::ItemView mItemView; ///< ItemView to hold test images. diff --git a/shared/dali-demo-strings.h b/shared/dali-demo-strings.h index f191dcb1..0f71b32d 100644 --- a/shared/dali-demo-strings.h +++ b/shared/dali-demo-strings.h @@ -16,8 +16,8 @@ */ /* This header file includes all multi language strings which need display */ -#ifndef __DALI_DEMO_STRINGS_H__ -#define __DALI_DEMO_STRINGS_H__ +#ifndef DALI_DEMO_STRINGS_H +#define DALI_DEMO_STRINGS_H #include <libintl.h> @@ -63,7 +63,6 @@ extern "C" #define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW") #define DALI_DEMO_STR_TITLE_POPUP dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_POPUP") #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES") -#define DALI_DEMO_STR_TITLE_RADIAL_MENU dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RADIAL_MENU") #define DALI_DEMO_STR_TITLE_REFRACTION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_REFRACTION") #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_RENDERER_STENCIL") #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI") @@ -111,7 +110,6 @@ extern "C" #define DALI_DEMO_STR_TITLE_PAGE_TURN_VIEW "Page Turn View" #define DALI_DEMO_STR_TITLE_POPUP "Popup" #define DALI_DEMO_STR_TITLE_PRIMITIVE_SHAPES "Primitive Shapes" -#define DALI_DEMO_STR_TITLE_RADIAL_MENU "Radial Menu" #define DALI_DEMO_STR_TITLE_REFRACTION "Refract Effect" #define DALI_DEMO_STR_TITLE_RENDERER_STENCIL "Renderer Stencils" #define DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI "Script Based UI" @@ -132,4 +130,4 @@ extern "C" } #endif // __cplusplus -#endif // __DALI_DEMO_STRINGS_H__ +#endif // DALI_DEMO_STRINGS_H |