Commit 2d811050bf107743f3312e42d38a56fc743b786b
1 parent
9c99f105
TextLabel demo updates
Change-Id: Ibe1177f1a5aae572f9539bd36321231f99bb48e9
Showing
1 changed file
with
11 additions
and
3 deletions
examples/text-label/text-label-example.cpp
| ... | ... | @@ -43,6 +43,7 @@ const unsigned int KEY_ONE = 11; |
| 43 | 43 | const unsigned int KEY_A = 38; |
| 44 | 44 | const unsigned int KEY_F = 41; |
| 45 | 45 | const unsigned int KEY_H = 43; |
| 46 | +const unsigned int KEY_U = 30; | |
| 46 | 47 | const unsigned int KEY_V = 55; |
| 47 | 48 | const unsigned int KEY_M = 58; |
| 48 | 49 | const unsigned int KEY_L = 46; |
| ... | ... | @@ -160,12 +161,13 @@ public: |
| 160 | 161 | mPanGestureDetector.DetectedSignal().Connect( this, &TextLabelExample::OnPan ); |
| 161 | 162 | |
| 162 | 163 | mLabel = TextLabel::New( "A Quick Brown Fox Jumps Over The Lazy Dog" ); |
| 164 | + | |
| 163 | 165 | mLabel.SetName( "TextLabel" ); |
| 164 | 166 | mLabel.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 165 | 167 | mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH ); |
| 166 | 168 | mLabel.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); |
| 167 | 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 | 171 | mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) ); |
| 170 | 172 | mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK ); |
| 171 | 173 | mLabel.SetBackgroundColor( Color::WHITE ); |
| ... | ... | @@ -187,7 +189,7 @@ public: |
| 187 | 189 | |
| 188 | 190 | // Animate the text color 3 times from source color to RED |
| 189 | 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 | 193 | animation.SetLoopCount( 3 ); |
| 192 | 194 | animation.Play(); |
| 193 | 195 | |
| ... | ... | @@ -252,7 +254,7 @@ public: |
| 252 | 254 | { |
| 253 | 255 | Animation animation = Animation::New( 2.f ); |
| 254 | 256 | animation.AnimateTo( Property( mLabel, DevelTextLabel::Property::TEXT_COLOR_ANIMATABLE ), Color::RED, AlphaFunction::SIN ); |
| 255 | - animation.SetLooping( true ); | |
| 257 | + animation.SetLoopCount( 3 ); | |
| 256 | 258 | animation.Play(); |
| 257 | 259 | break; |
| 258 | 260 | } |
| ... | ... | @@ -318,6 +320,12 @@ public: |
| 318 | 320 | } |
| 319 | 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 | 329 | case KEY_PLUS: // Increase shadow offset |
| 322 | 330 | { |
| 323 | 331 | mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, mLabel.GetProperty<Vector2>( TextLabel::Property::SHADOW_OFFSET ) + Vector2( 1.0f, 1.0f ) ); | ... | ... |