Commit 2d811050bf107743f3312e42d38a56fc743b786b

Authored by Agnelo Vaz
1 parent 9c99f105

TextLabel demo updates

Change-Id: Ibe1177f1a5aae572f9539bd36321231f99bb48e9
examples/text-label/text-label-example.cpp
@@ -43,6 +43,7 @@ const unsigned int KEY_ONE = 11; @@ -43,6 +43,7 @@ const unsigned int KEY_ONE = 11;
43 const unsigned int KEY_A = 38; 43 const unsigned int KEY_A = 38;
44 const unsigned int KEY_F = 41; 44 const unsigned int KEY_F = 41;
45 const unsigned int KEY_H = 43; 45 const unsigned int KEY_H = 43;
  46 +const unsigned int KEY_U = 30;
46 const unsigned int KEY_V = 55; 47 const unsigned int KEY_V = 55;
47 const unsigned int KEY_M = 58; 48 const unsigned int KEY_M = 58;
48 const unsigned int KEY_L = 46; 49 const unsigned int KEY_L = 46;
@@ -160,12 +161,13 @@ public: @@ -160,12 +161,13 @@ public:
160 mPanGestureDetector.DetectedSignal().Connect( this, &TextLabelExample::OnPan ); 161 mPanGestureDetector.DetectedSignal().Connect( this, &TextLabelExample::OnPan );
161 162
162 mLabel = TextLabel::New( "A Quick Brown Fox Jumps Over The Lazy Dog" ); 163 mLabel = TextLabel::New( "A Quick Brown Fox Jumps Over The Lazy Dog" );
  164 +
163 mLabel.SetName( "TextLabel" ); 165 mLabel.SetName( "TextLabel" );
164 mLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); 166 mLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT );
165 mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); 167 mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
166 mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); 168 mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT );
167 mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true ); 169 mLabel.SetProperty( TextLabel::Property::MULTI_LINE, true );
168 - mLabel.SetProperty( DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE, Color::BLUE ); 170 + mLabel.SetProperty( DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE, Color::GREEN );
169 mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) ); 171 mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) );
170 mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK ); 172 mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
171 mLabel.SetBackgroundColor( Color::WHITE ); 173 mLabel.SetBackgroundColor( Color::WHITE );
@@ -187,7 +189,7 @@ public: @@ -187,7 +189,7 @@ public:
187 189
188 // Animate the text color 3 times from source color to RED 190 // Animate the text color 3 times from source color to RED
189 Animation animation = Animation::New( 2.f ); 191 Animation animation = Animation::New( 2.f );
190 - animation.AnimateTo( Property( mLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::RED, AlphaFunction::SIN ); 192 + animation.AnimateTo( Property( mLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::YELLOW, AlphaFunction::SIN );
191 animation.SetLoopCount( 3 ); 193 animation.SetLoopCount( 3 );
192 animation.Play(); 194 animation.Play();
193 195
@@ -252,7 +254,7 @@ public: @@ -252,7 +254,7 @@ public:
252 { 254 {
253 Animation animation = Animation::New( 2.f ); 255 Animation animation = Animation::New( 2.f );
254 animation.AnimateTo( Property( mLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::RED, AlphaFunction::SIN ); 256 animation.AnimateTo( Property( mLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::RED, AlphaFunction::SIN );
255 - animation.SetLooping( true ); 257 + animation.SetLoopCount( 3 );
256 animation.Play(); 258 animation.Play();
257 break; 259 break;
258 } 260 }
@@ -318,6 +320,12 @@ public: @@ -318,6 +320,12 @@ public:
318 } 320 }
319 break; 321 break;
320 } 322 }
  323 + case KEY_U: // Markup
  324 + {
  325 + mLabel.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
  326 + mLabel.SetProperty( TextLabel::Property::TEXT, "<font family='DejaVuSerif' size='18'>H<color value='blue'>ello</color> <font weight='bold'>world</font> demo</font>" );
  327 + break;
  328 + }
321 case KEY_PLUS: // Increase shadow offset 329 case KEY_PLUS: // Increase shadow offset
322 { 330 {
323 mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, mLabel.GetProperty<Vector2>( TextLabel::Property::SHADOW_OFFSET ) + Vector2( 1.0f, 1.0f ) ); 331 mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, mLabel.GetProperty<Vector2>( TextLabel::Property::SHADOW_OFFSET ) + Vector2( 1.0f, 1.0f ) );