diff --git a/com.samsung.dali-demo.xml b/com.samsung.dali-demo.xml index 978f0f5..203ecce 100644 --- a/com.samsung.dali-demo.xml +++ b/com.samsung.dali-demo.xml @@ -88,6 +88,9 @@ + + + diff --git a/demo/dali-table-view.cpp b/demo/dali-table-view.cpp index 990a787..50b52a8 100644 --- a/demo/dali-table-view.cpp +++ b/demo/dali-table-view.cpp @@ -43,8 +43,7 @@ const std::string BUTTON_QUIT( "Quit" ); const std::string BUTTON_OK( "Ok" ); const std::string BUTTON_CANCEL( "Cancel" ); -const std::string DEFAULT_BACKGROUND_IMAGE_PATH( DALI_IMAGE_DIR "background-gradient.jpg" ); -const std::string LOGO_PATH( DALI_IMAGE_DIR "dali-logo.png" ); +const std::string LOGO_PATH( DALI_IMAGE_DIR "Logo-for-demo.png" ); const std::string DEFAULT_TOOLBAR_IMAGE_PATH( DALI_IMAGE_DIR "top-bar.png" ); const std::string BUTTON_BACKGROUND(DALI_IMAGE_DIR "button-background.png"); const std::string TILE_BACKGROUND(DALI_IMAGE_DIR "item-background.png"); @@ -88,14 +87,14 @@ const float BUBBLE_MAX_Z = 0.0f; /** * Creates the background image */ -ImageView CreateBackground( std::string imagePath ) +Control CreateBackground( std::string stylename ) { - Image image = ResourceImage::New( imagePath ); - ImageView background = ImageView::New( image ); + Control background = Control::New(); + Stage::GetCurrent().Add( background ); + background.SetProperty( Control::Property::STYLE_NAME,stylename); background.SetName( "BACKGROUND" ); background.SetAnchorPoint( AnchorPoint::CENTER ); background.SetParentOrigin( ParentOrigin::CENTER ); - background.SetZ( -1.0f ); background.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); return background; @@ -171,7 +170,6 @@ DaliTableView::DaliTableView( Application& application ) mBackgroundAnimations(), mExampleList(), mExampleMap(), - mBackgroundImagePath( DEFAULT_BACKGROUND_IMAGE_PATH ), mTotalPages(), mScrolling( false ), mSortAlphabetically( false ), @@ -190,11 +188,6 @@ void DaliTableView::AddExample( Example example ) mExampleMap[ example.name ] = example; } -void DaliTableView::SetBackgroundPath( std::string imagePath ) -{ - mBackgroundImagePath = imagePath; -} - void DaliTableView::SortAlphabetically( bool sortAlphabetically ) { mSortAlphabetically = sortAlphabetically; @@ -207,10 +200,10 @@ void DaliTableView::Initialize( Application& application ) const Vector2 stageSize = Stage::GetCurrent().GetSize(); // Background - ImageView background = CreateBackground( mBackgroundImagePath ); + Control background = CreateBackground( "launcherbackground" ); Stage::GetCurrent().Add( background ); - // Render entire content as overlays, as is all on same 2D plane. + // Add root actor mRootActor = TableView::New( 4, 1 ); mRootActor.SetAnchorPoint( AnchorPoint::CENTER ); mRootActor.SetParentOrigin( ParentOrigin::CENTER ); diff --git a/demo/dali-table-view.h b/demo/dali-table-view.h index 8b1353d..9db332d 100644 --- a/demo/dali-table-view.h +++ b/demo/dali-table-view.h @@ -99,15 +99,6 @@ public: void AddExample(Example example); /** - * Sets the background image PATH. - * - * @param[in] imagePath The file path to the image to use as the background. - * - * @note Should be called before the Application MainLoop is started. - */ - void SetBackgroundPath( std::string imagePath ); - - /** * Sorts the example list alphabetically by Title if parameter is true. * * @param[in] sortAlphabetically If true, example list is sorted alphabetically. @@ -407,7 +398,6 @@ private: ExampleList mExampleList; ///< List of examples. ExampleMap mExampleMap; ///< Map LUT for examples. - std::string mBackgroundImagePath; ///< The path to the background image. int mTotalPages; ///< Total pages within scrollview. bool mScrolling:1; ///< Flag indicating whether view is currently being scrolled diff --git a/examples/dissolve-effect/dissolve-effect-example.cpp b/examples/dissolve-effect/dissolve-effect-example.cpp index a961320..5d81d17 100644 --- a/examples/dissolve-effect/dissolve-effect-example.cpp +++ b/examples/dissolve-effect/dissolve-effect-example.cpp @@ -77,7 +77,7 @@ const int VIEWINGTIME = 2000; // 2 seconds const float TRANSITION_DURATION = 2.5f; //2.5 second -const float INITIAL_DEPTH = -10.0f; +const float INITIAL_DEPTH = 10.0f; /** * @brief Load an image, scaled-down to no more than the stage dimensions. @@ -163,12 +163,13 @@ private: Toolkit::TextLabel mTitleActor; Actor mParent; - ImageActor mCurrentImage; - ImageActor mNextImage; + Toolkit::ImageView mCurrentImage; + Toolkit::ImageView mNextImage; unsigned int mIndex; - ShaderEffect mCurrentImageEffect; - ShaderEffect mNextImageEffect; + Property::Map mDissolveEffect; + Property::Map mEmptyEffect; + bool mUseHighPrecision; Animation mAnimation; @@ -180,8 +181,16 @@ private: bool mTimerReady; unsigned int mCentralLineIndex; + Image mIconPlay; + Image mIconPlaySelected; + Image mIconStop; + Image mIconStopSelected; Toolkit::PushButton mPlayStopButton; + Image mIconHighP; + Image mIconHighPSelected; + Image mIconMediumP; + Image mIconMediumPSelected; Toolkit::PushButton mEffectChangeButton; }; @@ -210,9 +219,13 @@ void DissolveEffectApp::OnInit( Application& application ) mContent = DemoHelper::CreateView( application, mView,mToolBar, "", TOOLBAR_IMAGE, "" ); // Add an effect-changing button on the right of the tool bar. + mIconHighP = ResourceImage::New( EFFECT_HIGHP_IMAGE ); + mIconHighPSelected = ResourceImage::New( EFFECT_HIGHP_IMAGE_SELECTED ); + mIconMediumP = ResourceImage::New( EFFECT_MEDIUMP_IMAGE ); + mIconMediumPSelected = ResourceImage::New( EFFECT_MEDIUMP_IMAGE_SELECTED ); mEffectChangeButton = Toolkit::PushButton::New(); - mEffectChangeButton.SetUnselectedImage( EFFECT_HIGHP_IMAGE ); - mEffectChangeButton.SetSelectedImage( EFFECT_HIGHP_IMAGE_SELECTED ); + mEffectChangeButton.SetButtonImage( mIconHighP ); + mEffectChangeButton.SetSelectedImage( mIconHighPSelected ); mEffectChangeButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnEffectButtonClicked ); mToolBar.AddControl( mEffectChangeButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalRight, DemoHelper::DEFAULT_MODE_SWITCH_PADDING ); @@ -221,9 +234,13 @@ void DissolveEffectApp::OnInit( Application& application ) mToolBar.AddControl( mTitleActor, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarTitlePercentage, Toolkit::Alignment::HorizontalCenter ); // Add an slide-show button on the right of the title + mIconPlay = ResourceImage::New( PLAY_ICON ); + mIconPlaySelected = ResourceImage::New( PLAY_ICON_SELECTED ); + mIconStop = ResourceImage::New( STOP_ICON ); + mIconStopSelected = ResourceImage::New( STOP_ICON_SELECTED ); mPlayStopButton = Toolkit::PushButton::New(); - mPlayStopButton.SetUnselectedImage( PLAY_ICON ); - mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED ); + mPlayStopButton.SetButtonImage( mIconPlay ); + mPlayStopButton.SetSelectedImage( mIconPlaySelected ); mPlayStopButton.ClickedSignal().Connect( this, &DissolveEffectApp::OnSildeshowButtonClicked ); mToolBar.AddControl( mPlayStopButton, DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage, Toolkit::Alignment::HorizontalCenter, DemoHelper::DEFAULT_PLAY_PADDING ); @@ -231,10 +248,6 @@ void DissolveEffectApp::OnInit( Application& application ) mPanGestureDetector = PanGestureDetector::New(); mPanGestureDetector.DetectedSignal().Connect( this, &DissolveEffectApp::OnPanGesture ); - // create the dissolve effect object - mCurrentImageEffect = Toolkit::CreateDissolveEffect(mUseHighPrecision); - mNextImageEffect = Toolkit::CreateDissolveEffect(mUseHighPrecision); - mViewTimer = Timer::New( VIEWINGTIME ); mViewTimer.TickSignal().Connect( this, &DissolveEffectApp::OnTimerTick ); mTimerReady = true; @@ -246,13 +259,16 @@ void DissolveEffectApp::OnInit( Application& application ) mContent.Add( mParent ); // show the first image - mCurrentImage = ImageActor::New( LoadStageFillingImage( IMAGES[mIndex] ) ); + mCurrentImage = Toolkit::ImageView::New( LoadStageFillingImage( IMAGES[mIndex] ) ); mCurrentImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); mCurrentImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mCurrentImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); mParent.Add( mCurrentImage ); mPanGestureDetector.Attach( mCurrentImage ); + + mDissolveEffect = Dali::Toolkit::CreateDissolveEffect( mUseHighPrecision ); + mEmptyEffect.Insert( "shader", Property::Value() ); } // signal handler, called when the pan gesture is detected @@ -276,7 +292,7 @@ void DissolveEffectApp::OnPanGesture( Actor actor, const PanGesture& gesture ) } Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); - mNextImage = ImageActor::New( image ); + mNextImage = Toolkit::ImageView::New( image ); mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); @@ -291,20 +307,18 @@ void DissolveEffectApp::StartTransition(Vector2 position, Vector2 displacement) { mAnimation = Animation::New(TRANSITION_DURATION); - Dali::Toolkit::DissolveEffectSetCentralLine( mCurrentImageEffect, position, displacement ); - mCurrentImageEffect.SetUniform("uPercentage", 0.0f); - mCurrentImage.SetShaderEffect(mCurrentImageEffect); - mAnimation.AnimateTo( Property(mCurrentImageEffect, "uPercentage"), 1.0f, AlphaFunction::LINEAR ); + Dali::Toolkit::DissolveEffectSetCentralLine( mCurrentImage, position, displacement, 0.0f ); + mCurrentImage.SetProperty( Toolkit::ImageView::Property::IMAGE, mDissolveEffect ); + mAnimation.AnimateTo( Property( mCurrentImage, "uPercentage" ), 1.0f, AlphaFunction::LINEAR ); mNextImage.SetOpacity(0.0f); mAnimation.AnimateTo( Property( mNextImage, Actor::Property::COLOR_ALPHA ), 1.0f, AlphaFunction::LINEAR ); if(mUseHighPrecision) { - Dali::Toolkit::DissolveEffectSetCentralLine( mNextImageEffect, position, displacement ); - mNextImageEffect.SetUniform("uPercentage", 1.0f); - mNextImage.SetShaderEffect(mNextImageEffect); - mAnimation.AnimateTo( Property(mNextImageEffect, "uPercentage"), 0.0f, AlphaFunction::LINEAR ); + Dali::Toolkit::DissolveEffectSetCentralLine( mNextImage, position, displacement, 1.0f ); + mNextImage.SetProperty( Toolkit::ImageView::Property::IMAGE, mDissolveEffect ); + mAnimation.AnimateTo( Property( mNextImage, "uPercentage" ), 0.0f, AlphaFunction::LINEAR ); } else { @@ -330,18 +344,18 @@ void DissolveEffectApp::OnKeyEvent(const KeyEvent& event) bool DissolveEffectApp::OnEffectButtonClicked( Toolkit::Button button ) { mUseHighPrecision = !mUseHighPrecision; - mCurrentImageEffect = Dali::Toolkit::CreateDissolveEffect(mUseHighPrecision); + mDissolveEffect = Dali::Toolkit::CreateDissolveEffect(mUseHighPrecision); if(mUseHighPrecision) { mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_HIGHP) ); - mEffectChangeButton.SetUnselectedImage( EFFECT_HIGHP_IMAGE ); - mEffectChangeButton.SetSelectedImage( EFFECT_HIGHP_IMAGE_SELECTED ); + mEffectChangeButton.SetButtonImage( mIconHighP ); + mEffectChangeButton.SetSelectedImage( mIconHighPSelected ); } else { mTitleActor.SetProperty( TextLabel::Property::TEXT, std::string(APPLICATION_TITLE_MEDIUMP) ); - mEffectChangeButton.SetUnselectedImage( EFFECT_MEDIUMP_IMAGE ); - mEffectChangeButton.SetSelectedImage( EFFECT_MEDIUMP_IMAGE_SELECTED ); + mEffectChangeButton.SetButtonImage( mIconMediumP ); + mEffectChangeButton.SetSelectedImage( mIconMediumPSelected ); } return true; @@ -352,16 +366,16 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button ) mSlideshow = !mSlideshow; if( mSlideshow ) { - mPlayStopButton.SetUnselectedImage( STOP_ICON ); - mPlayStopButton.SetSelectedImage( STOP_ICON_SELECTED ); + mPlayStopButton.SetButtonImage( mIconStop ); + mPlayStopButton.SetSelectedImage( mIconStopSelected ); mPanGestureDetector.Detach( mParent ); mViewTimer.Start(); mTimerReady = false; } else { - mPlayStopButton.SetUnselectedImage( PLAY_ICON ); - mPlayStopButton.SetSelectedImage( PLAY_ICON_SELECTED ); + mPlayStopButton.SetButtonImage( mIconPlay ); + mPlayStopButton.SetSelectedImage( mIconPlaySelected ); mTimerReady = true; mPanGestureDetector.Attach( mParent ); } @@ -370,8 +384,7 @@ bool DissolveEffectApp::OnSildeshowButtonClicked( Toolkit::Button button ) void DissolveEffectApp::OnTransitionCompleted( Animation& source ) { - mCurrentImage.RemoveShaderEffect(); - mNextImage.RemoveShaderEffect(); + mNextImage.SetProperty( Toolkit::ImageView::Property::IMAGE, mEmptyEffect ); mParent.Remove( mCurrentImage ); mPanGestureDetector.Detach( mCurrentImage ); mCurrentImage = mNextImage; @@ -392,7 +405,7 @@ bool DissolveEffectApp::OnTimerTick() { mIndex = (mIndex + 1)%NUM_IMAGES; Image image = LoadStageFillingImage( IMAGES[ mIndex ] ); - mNextImage = ImageActor::New( image ); + mNextImage = Toolkit::ImageView::New( image ); mNextImage.SetPositionInheritanceMode(USE_PARENT_POSITION_PLUS_LOCAL_POSITION); mNextImage.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS ); mNextImage.SetSizeScalePolicy( SizeScalePolicy::FIT_WITH_ASPECT_RATIO ); diff --git a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp index 9c05909..5b240f5 100644 --- a/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp +++ b/examples/image-scaling-and-filtering/image-scaling-and-filtering-example.cpp @@ -194,14 +194,14 @@ public: mHeightBox = Toolkit::ImageView::New( heightBackground ); mHeightBox.SetOpacity( 0.2f ); - stage.Add( mHeightBox ); + background.Add( mHeightBox ); mWidthBox = Toolkit::ImageView::New( widthBackground ); mWidthBox.SetOpacity( 0.2f ); - stage.Add( mWidthBox ); + background.Add( mWidthBox ); mDesiredBox = Toolkit::ImageView::New( desiredBackground ); - stage.Add( mDesiredBox ); + background.Add( mDesiredBox ); mDesiredBox.SetSize( stage.GetSize() * mImageStageScale ); mDesiredBox.SetParentOrigin( ParentOrigin::CENTER ); @@ -247,7 +247,7 @@ public: mImageActor.SetSortModifier(5.f); // Display the actor on the stage - stage.Add( mImageActor ); + background.Add( mImageActor ); mImageActor.SetSize( stage.GetSize() * mImageStageScale ); diff --git a/examples/item-view/item-view-example.cpp b/examples/item-view/item-view-example.cpp index 038d5e0..86f844d 100644 --- a/examples/item-view/item-view-example.cpp +++ b/examples/item-view/item-view-example.cpp @@ -26,6 +26,7 @@ #include #include #include +#include using namespace Dali; using namespace Dali::Toolkit; @@ -291,6 +292,9 @@ public: mReplaceButton.SetVisible( false ); stage.Add( mReplaceButton ); + // Store one 1x1 white image for multiple items to share for backgrounds: + mWhiteImage = BufferImage::WHITE(); + // Create the item view actor mImageAtlas = CreateImageAtlas(); mItemView = ItemView::New(*this); @@ -322,9 +326,6 @@ public: // Set the title and icon to the current layout SetLayoutTitle(); SetLayoutImage(); - - // Store one 1x1 white image for multiple items to share for backgrounds: - mWhiteImage = BufferImage::WHITE(); } Actor OnKeyboardPreFocusChange( Actor current, Actor proposed, Control::KeyboardFocus::Direction direction ) @@ -891,7 +892,8 @@ public: // From ItemFactory checkbox.SetSize( spiralItemSize.width * 0.2f, spiralItemSize.width * 0.2f ); checkbox.SetPosition( -SELECTION_BORDER_WIDTH, SELECTION_BORDER_WIDTH ); checkbox.SetZ( 1.0f ); - checkbox.SetSortModifier( -50.0f ); + SetCullFace(checkbox, Dali::CullBack); + checkbox.SetSortModifier( 150.0f ); if( MODE_REMOVE_MANY != mMode && MODE_INSERT_MANY != mMode && MODE_REPLACE_MANY != mMode ) @@ -907,8 +909,9 @@ public: // From ItemFactory tick.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); tick.SetSize( spiralItemSize.width * 0.2f, spiralItemSize.width * 0.2f ); tick.SetZ( 1.0f ); - tick.SetSortModifier( -50.0f ); + tick.SetSortModifier( 150.0f ); tick.SetVisible( false ); + SetCullFace(tick, Dali::CullBack); checkbox.Add( tick ); // Connect new items for various editing modes diff --git a/examples/magnifier/magnifier-example.cpp b/examples/magnifier/magnifier-example.cpp index b5632d5..8f0945d 100644 --- a/examples/magnifier/magnifier-example.cpp +++ b/examples/magnifier/magnifier-example.cpp @@ -223,7 +223,7 @@ public: Stage::GetCurrent().Add(overlay); mMagnifier = Toolkit::Magnifier::New(); - mMagnifier.SetSourceActor( mView.GetChildAt( 0 ) ); + mMagnifier.SetSourceActor( mView ); mMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width mMagnifier.SetProperty( Toolkit::Magnifier::Property::MAGNIFICATION_FACTOR, MAGNIFICATION_FACTOR ); mMagnifier.SetScale(Vector3::ZERO); @@ -240,7 +240,7 @@ public: // Create bouncing magnifier automatically bounces around screen. mBouncingMagnifier = Toolkit::Magnifier::New(); - mBouncingMagnifier.SetSourceActor( mView.GetChildAt( 0 ) ); + mBouncingMagnifier.SetSourceActor( mView ); mBouncingMagnifier.SetSize( MAGNIFIER_SIZE * mStageSize.width ); // Size of magnifier is in relation to stage width mBouncingMagnifier.SetProperty( Toolkit::Magnifier::Property::MAGNIFICATION_FACTOR, MAGNIFICATION_FACTOR ); overlay.Add( mBouncingMagnifier ); diff --git a/examples/text-fonts/text-fonts-example.cpp b/examples/text-fonts/text-fonts-example.cpp new file mode 100644 index 0000000..fb1337b --- /dev/null +++ b/examples/text-fonts/text-fonts-example.cpp @@ -0,0 +1,263 @@ +/* + * 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. + * + */ + +/** + * @file text-fonts-example.cpp + * @brief Example of various TextLabel each with different font set ups, + * enables Testing of Font when the system font changes. + The first label is free, with no font family set, it could use the default system font and change as it changes. + The second label has it's font family set via the demo json file. It should not change when the system font changes. + The third label has it's font family set in code via SetProperty. It also should not change when the system font changes. + The forth label is not shown until the button along the bottom is pressed, it has no font set so the newly created label should use the system font, + Pressing the button again resets and unparents that button and then re-adds it. + */ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include "shared/multi-language-strings.h" +#include "shared/view.h" + +using namespace Dali; +using namespace Dali::Toolkit; +using namespace MultiLanguageStrings; + +namespace +{ + const char* const LABEL_TEXT = "A Quick Fox"; + const char* const LABEL_TEXT_MIXED = "Fox 구미호"; + const char* const LABEL_TEXT_KOREAN = "구미호"; +} + +/** + * @brief The main class of the demo. + */ +class TextFontsExample : public ConnectionTracker +{ +public: + + TextFontsExample( Application& application ) + : mApplication( application ), + mToggle(true) + { + // Connect to the Application's Init signal + mApplication.InitSignal().Connect( this, &TextFontsExample::Create ); + } + + ~TextFontsExample() + { + // Nothing to do here. + } + + void CreateTextLabel( TextLabel& textLabel, std::string textString, const Vector4& color, bool infoLabel=false ) + { + textLabel = TextLabel::New( textString ); + textLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); + textLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); + textLabel.SetProperty( TextLabel::Property::MULTI_LINE, true ); + if ( infoLabel ) + { + textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::WHITE ); + textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 12.0f ); + textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "SamsungOneUI" ); + } + else + { + textLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 0.3f, 0.3f ) ); + textLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK ); + textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE ); + } + textLabel.SetBackgroundColor( color ); + } + + void CreateContainer( Control& container, const Vector2 size ) + { + container = Control::New(); + container.SetSize( size ); + container.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + container.SetDrawMode( DrawMode::OVERLAY_2D ); + } + + void CreateFolderButton( PushButton& button ) + { + button = PushButton::New(); + button.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER ); + button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); + button.SetSize( 50.0f, 50.0f ); + } + + bool OnButtonClicked( Toolkit::Button button ) + { + if ( mLabel4 ) + { + UnparentAndReset( mLabel4 ); + } + + if ( !mContainer4 ) + { + CreateContainer ( mContainer4 , mLayoutSize); + Stage stage = Stage::GetCurrent(); + Vector2 stageSize = stage.GetSize(); + mContainer4.SetPosition( 0, stageSize.height*0.25f*3 ); + stage.Add( mContainer4 ); + // Info + CreateContainer ( mContainer4Info , mLayoutSize ); + mContainer4Info.SetParentOrigin( ParentOrigin::TOP_RIGHT ); + mContainer4.Add( mContainer4Info ); + CreateTextLabel ( mLabel4Info, "system free", Color::BLACK, true ); + mContainer4Info.Add ( mLabel4Info ); + } + + if ( mToggle ) + { + CreateTextLabel ( mLabel4, LABEL_TEXT_KOREAN, Color::WHITE ); + mToggle = false; + } + else + { + CreateTextLabel ( mLabel4, LABEL_TEXT_MIXED, Color::WHITE ); + mToggle = true; + } + + mContainer4.Add( mLabel4 ); + + return true; + } + + /** + * One-time setup in response to Application InitSignal. + */ + void Create( Application& application ) + { + Stage stage = Stage::GetCurrent(); + Vector2 stageSize = stage.GetSize(); + + stage.KeyEventSignal().Connect(this, &TextFontsExample::OnKeyEvent); + + CreateFolderButton ( mButton ); + mButton.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); + mButton.ClickedSignal().Connect( this, &TextFontsExample::OnButtonClicked ); + stage.Add( mButton ); + + mLayoutSize = Vector2( stageSize.width*0.5f, stageSize.height*0.10f ); + CreateContainer ( mContainer , mLayoutSize); + CreateContainer ( mContainer2 , mLayoutSize ); + CreateContainer ( mContainer3 , mLayoutSize ); + + // Info about Text Label and if font should be fixed or free to change with system + CreateContainer ( mContainerInfo , mLayoutSize ); + CreateContainer ( mContainer2Info , mLayoutSize ); + CreateContainer ( mContainer3Info , mLayoutSize ); + mContainerInfo.SetParentOrigin( ParentOrigin::TOP_RIGHT ); + mContainer2Info.SetParentOrigin( ParentOrigin::TOP_RIGHT ); + mContainer3Info.SetParentOrigin( ParentOrigin::TOP_RIGHT ); + mContainer.Add( mContainerInfo ); + mContainer2.Add( mContainer2Info ); + mContainer3.Add( mContainer3Info ); + CreateTextLabel ( mLabelInfo, "system free", Color::BLACK, true ); + CreateTextLabel ( mLabel2Info, "json fixed", Color::BLACK, true ); + CreateTextLabel ( mLabel3Info, "SetProp fixed", Color::BLACK, true ); + mContainerInfo.Add( mLabelInfo ); + mContainer2Info.Add( mLabel2Info ); + mContainer3Info.Add( mLabel3Info ); + + stage.Add( mContainer ); + stage.Add( mContainer2 ); + stage.Add( mContainer3 ); + + CreateTextLabel ( mLabel, LABEL_TEXT, Color::WHITE ); + + CreateTextLabel ( mLabel2, LABEL_TEXT, Color::WHITE ); + mLabel2.SetStyleName("textlabel-Rosemary"); + + CreateTextLabel ( mLabel3, LABEL_TEXT, Color::WHITE ); + mLabel3.SetProperty( TextLabel::Property::FONT_FAMILY, "SamsungOneUI" ); + + mContainer.SetPosition( 0, 0 ); + mContainer2.SetPosition( 0, stageSize.height*0.25f ); + mContainer3.SetPosition( 0, stageSize.height*0.25f*2 ); + + mContainer.Add( mLabel ); + mContainer2.Add( mLabel2 ); + mContainer3.Add( mLabel3 ); + } + + /** + * Main key event handler + */ + void OnKeyEvent(const KeyEvent& event) + { + if(event.state == KeyEvent::Down) + { + if( IsKey( event, DALI_KEY_ESCAPE) || IsKey( event, DALI_KEY_BACK ) ) + { + mApplication.Quit(); + } + } + } + +private: + + Application& mApplication; + + PushButton mButton; + + TextLabel mLabel; + TextLabel mLabel2; + TextLabel mLabel3; + + TextLabel mLabel4; + + Control mContainer; + Control mContainer2; + Control mContainer3; + Control mContainer4; + + Control mContainerInfo; + Control mContainer2Info; + Control mContainer3Info; + Control mContainer4Info; + + TextLabel mLabelInfo; + TextLabel mLabel2Info; + TextLabel mLabel3Info; + TextLabel mLabel4Info; + + Vector2 mLayoutSize; + + bool mToggle; +}; + +void RunTest( Application& application ) +{ + TextFontsExample test( application ); + + application.MainLoop(); +} + +/** Entry point for Linux & Tizen applications */ +int main( int argc, char **argv ) +{ + Application application = Application::New( &argc, &argv, DALI_DEMO_THEME_PATH ); + + RunTest( application ); + + return 0; +} diff --git a/examples/textured-mesh/textured-mesh-example.cpp b/examples/textured-mesh/textured-mesh-example.cpp index 3b65701..1597aca 100644 --- a/examples/textured-mesh/textured-mesh-example.cpp +++ b/examples/textured-mesh/textured-mesh-example.cpp @@ -165,9 +165,7 @@ public: mMeshActor.AddRenderer( mRenderer ); mMeshActor.SetSize(400, 400); - Property::Index fadeColorIndex = mMeshActor.RegisterProperty( "uFadeColor", Color::GREEN ); - - fadeColorIndex = mRenderer.RegisterProperty( "uFadeColor", Color::MAGENTA ); + Property::Index fadeColorIndex = mRenderer.RegisterProperty( "uFadeColor", Color::MAGENTA ); mRenderer.SetDepthIndex(0); mMeshActor.SetParentOrigin( ParentOrigin::TOP_CENTER ); @@ -181,11 +179,10 @@ public: mMeshActor2.SetSize(400, 400); mMeshActor2.RegisterProperty( "a-n-other-property", Color::GREEN ); - Property::Index fadeColorIndex2 = mMeshActor2.RegisterProperty( "uFadeColor", Color::GREEN ); mRenderer2.RegisterProperty( "a-n-other-property", Vector3::ZERO ); mRenderer2.RegisterProperty( "a-coefficient", 0.008f ); - fadeColorIndex2 = mRenderer2.RegisterProperty( "uFadeColor", Color::BLUE ); + Property::Index fadeColorIndex2 = mRenderer2.RegisterProperty( "uFadeColor", Color::BLUE ); mRenderer2.SetDepthIndex(0); mMeshActor2.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); diff --git a/packaging/com.samsung.dali-demo.spec b/packaging/com.samsung.dali-demo.spec index 1894aed..870674b 100755 --- a/packaging/com.samsung.dali-demo.spec +++ b/packaging/com.samsung.dali-demo.spec @@ -2,7 +2,7 @@ Name: com.samsung.dali-demo Summary: The OpenGLES Canvas Core Demo -Version: 1.1.4 +Version: 1.1.5 Release: 1 Group: System/Libraries License: Apache-2.0 diff --git a/resources/images/Logo-for-demo.png b/resources/images/Logo-for-demo.png new file mode 100644 index 0000000..ab8c2a4 --- /dev/null +++ b/resources/images/Logo-for-demo.png diff --git a/resources/style/demo-theme.json b/resources/style/demo-theme.json index 96649e7..64fe786 100644 --- a/resources/style/demo-theme.json +++ b/resources/style/demo-theme.json @@ -22,13 +22,15 @@ distributing this software or its derivatives. { "styles": { + "textlabel-Rosemary": + { + "font-family":"Rosemary" + }, "textlabel": { - "font-family":"HelveticaNeue", "font-style":"Regular", "point-size":18 }, - "launcherlabel": { "point-size":18 @@ -57,6 +59,19 @@ distributing this software or its derivatives. "buttonlabel": { "point-size":11 + }, + + "launcherbackground": + { + "background": + { + "renderer-type": "gradient-renderer", + "gradient-center": [240, 400], + "gradient-radius": 932, + "gradient-units": "user-space", + "gradient-stop-color": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]], + "gradient-stop-offset":[0.0,1.0] + } } } } diff --git a/resources/style/mobile/demo-theme.json b/resources/style/mobile/demo-theme.json index 1ba331d..653fbea 100644 --- a/resources/style/mobile/demo-theme.json +++ b/resources/style/mobile/demo-theme.json @@ -22,13 +22,15 @@ distributing this software or its derivatives. { "styles": { + "textlabel-Rosemary": + { + "font-family":"Rosemary" + }, "textlabel": { - "font-family":"SamsungSans", "font-style":"Regular", "point-size":18 }, - "textlabel-font-size-0": { "point-size":8 @@ -64,7 +66,7 @@ distributing this software or its derivatives. { "point-size":10 }, - + "scrollview": { "overshoot-effect-color":"B018" @@ -78,6 +80,19 @@ distributing this software or its derivatives. "buttonlabel": { "point-size":8 + }, + + "launcherbackground": + { + "background": + { + "renderer-type": "gradient-renderer", + "gradient-center": [360, 640], + "gradient-radius": 1468, + "gradient-units": "user-space", + "gradient-stop-color": [[0.247,0.38,0.52,1.0],[0.055,0.18,0.286,1.0]], + "gradient-stop-offset":[0.0,1.0] + } } } }