From 2d811050bf107743f3312e42d38a56fc743b786b Mon Sep 17 00:00:00 2001 From: Agnelo Vaz Date: Fri, 4 Aug 2017 15:46:44 +0100 Subject: [PATCH] TextLabel demo updates Change-Id: Ibe1177f1a5aae572f9539bd36321231f99bb48e9 --- examples/text-label/text-label-example.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/examples/text-label/text-label-example.cpp b/examples/text-label/text-label-example.cpp index d7c7315..b47e56e 100644 --- a/examples/text-label/text-label-example.cpp +++ b/examples/text-label/text-label-example.cpp @@ -43,6 +43,7 @@ const unsigned int KEY_ONE = 11; const unsigned int KEY_A = 38; const unsigned int KEY_F = 41; const unsigned int KEY_H = 43; +const unsigned int KEY_U = 30; const unsigned int KEY_V = 55; const unsigned int KEY_M = 58; const unsigned int KEY_L = 46; @@ -160,12 +161,13 @@ public: mPanGestureDetector.DetectedSignal().Connect( this, &TextLabelExample::OnPan ); mLabel = TextLabel::New( "A Quick Brown Fox Jumps Over The Lazy Dog" ); + mLabel.SetName( "TextLabel" ); mLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true ); - mLabel.SetProperty( DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE, Color::BLUE ); + mLabel.SetProperty( DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE, Color::GREEN ); mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) ); mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK ); mLabel.SetBackgroundColor( Color::WHITE ); @@ -187,7 +189,7 @@ public: // Animate the text color 3 times from source color to RED Animation animation = Animation::New( 2.f ); - animation.AnimateTo( Property( mLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::RED, AlphaFunction::SIN ); + animation.AnimateTo( Property( mLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::YELLOW, AlphaFunction::SIN ); animation.SetLoopCount( 3 ); animation.Play(); @@ -252,7 +254,7 @@ public: { Animation animation = Animation::New( 2.f ); animation.AnimateTo( Property( mLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::RED, AlphaFunction::SIN ); - animation.SetLooping( true ); + animation.SetLoopCount( 3 ); animation.Play(); break; } @@ -318,6 +320,12 @@ public: } break; } + case KEY_U: // Markup + { + mLabel.SetProperty( TextLabel::Property::ENABLE_MARKUP, true ); + mLabel.SetProperty( TextLabel::Property::TEXT, "Hello world demo" ); + break; + } case KEY_PLUS: // Increase shadow offset { mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, mLabel.GetProperty( TextLabel::Property::SHADOW_OFFSET ) + Vector2( 1.0f, 1.0f ) ); -- 2.7.4