}
case GRID_LAYOUT:
{
- stage.GetRootLayer().SetBehavior(Layer::LAYER_2D);
+ stage.GetRootLayer().SetBehavior(Layer::LAYER_UI);
break;
}
}
layer.SetParentOrigin( ParentOrigin::CENTER );
layer.SetAnchorPoint( AnchorPoint::CENTER );
layer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- layer.SetBehavior( Layer::LAYER_2D ); //We use a 2D layer as this is closer to UI work than full 3D scene creation.
+ layer.SetBehavior( Layer::LAYER_UI ); //We use a 2D layer as this is closer to UI work than full 3D scene creation.
layer.SetDepthTestDisabled( false ); //Enable depth testing, as otherwise the 2D layer would not do so.
stage.Add( layer );
layer.SetAnchorPoint( AnchorPoint::CENTER );
// Set the parent origin to a small percentage below the center (so the demo will scale for different resolutions).
layer.SetParentOrigin( Vector3( 0.5f, 0.58f, 0.5f ) );
- layer.SetBehavior( Layer::LAYER_2D );
+ layer.SetBehavior( Layer::LAYER_UI );
layer.SetDepthTestDisabled( false );
stage.Add( layer );
}
else
{
- textLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 0.3f, 0.3f ) );
- textLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
+ Property::Map shadowMap;
+ shadowMap.Insert( "color", Color::BLACK );
+ shadowMap.Insert( "offset", Vector2( 0.3f, 0.3f ) );
+ textLabel.SetProperty( TextLabel::Property::SHADOW, shadowMap );
textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
}
textLabel.SetBackgroundColor( color );
case SHADOW :
{
Vector2 shadowOffset( SHADOW_OFFSET ); // Will be set to zeros if color already set
- Property::Value value = mLabel.GetProperty( TextLabel::Property::SHADOW_COLOR );
+ Property::Value value = mLabel.GetProperty( TextLabel::Property::SHADOW );
Vector4 currentShadowColor;
value.Get( currentShadowColor );
}
case KEY_S: // Shadow color
{
- if( Color::BLACK == mLabel.GetProperty<Vector4>( TextLabel::Property::SHADOW_COLOR ) )
+ Property::Value value = mLabel.GetProperty( TextLabel::Property::SHADOW );
+ Vector4 shadowColor;
+ value.Get( shadowColor );
+ Property::Map shadowMap;
+ if( Color::BLACK == shadowColor )
{
- mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::RED );
+ shadowMap.Insert( "color", Color::RED );
+ mLabel.SetProperty( TextLabel::Property::SHADOW, shadowMap );
}
else
{
- mLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
+ shadowMap.Insert( "color", Color::BLACK );
+ mLabel.SetProperty( TextLabel::Property::SHADOW, shadowMap );
}
break;
}
}
case KEY_PLUS: // Increase shadow offset
{
- mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, mLabel.GetProperty<Vector2>( TextLabel::Property::SHADOW_OFFSET ) + Vector2( 1.0f, 1.0f ) );
+ Property::Value value = mLabel.GetProperty( TextLabel::Property::SHADOW );
+ Vector2 shadowOffset;
+ value.Get( shadowOffset );
+ shadowOffset += Vector2( 1.0f, 1.0f );
+
+ Property::Map shadowMap;
+ shadowMap.Insert( "offset", shadowOffset );
+ mLabel.SetProperty( TextLabel::Property::SHADOW, shadowMap );
break;
}
case KEY_MINUS: // Decrease shadow offset
{
- mLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, mLabel.GetProperty<Vector2>( TextLabel::Property::SHADOW_OFFSET ) - Vector2( 1.0f, 1.0f ) );
+ Property::Value value = mLabel.GetProperty( TextLabel::Property::SHADOW );
+ Vector2 shadowOffset;
+ value.Get( shadowOffset );
+ shadowOffset -= Vector2( 1.0f, 1.0f );
+
+ Property::Map shadowMap;
+ shadowMap.Insert( "offset", shadowOffset );
+ mLabel.SetProperty( TextLabel::Property::SHADOW, shadowMap );
break;
}
label.SetAnchorPoint( AnchorPoint::TOP_LEFT );
label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK );
label.SetProperty( TextLabel::Property::POINT_SIZE, 12.0f );
- label.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::YELLOW );
+ Property::Map shadowMap;
+ shadowMap.Insert( "color", Color::YELLOW );
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
Vector2 stageSize = Stage::GetCurrent().GetSize();
case SINGLE_COLOR_TEXT:
{
label.SetProperty( TextLabel::Property::TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" );
- label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 0.0f, 0.0f ) );
+
+ shadowMap.Insert( "offset", Vector2( 0.0f, 0.0f ) );
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
break;
}
case SINGLE_COLOR_TEXT_WITH_STYLE:
{
label.SetProperty( TextLabel::Property::TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" );
- label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 2.0f, 2.0f ) );
+
+ shadowMap.Insert( "offset", Vector2( 2.0f, 2.0f ) );
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
break;
}
case SINGLE_COLOR_TEXT_WITH_EMOJI:
{
label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 A Quick Brown Fox Jumps Over The Lazy Dog" );
- label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 0.0f, 0.0f ) );
+
+ shadowMap.Insert( "offset", Vector2( 0.0f, 0.0f ) );
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
break;
}
case SINGLE_COLOR_TEXT_WITH_STYLE_EMOJI:
{
label.SetProperty( TextLabel::Property::TEXT, "\xF0\x9F\x98\x81 A Quick Brown Fox Jumps Over The Lazy Dog" );
- label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 2.0f, 2.0f ) );
+
+ shadowMap.Insert( "offset", Vector2( 2.0f, 2.0f ) );
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
break;
}
case MULTI_COLOR_TEXT:
{
label.SetProperty( TextLabel::Property::TEXT, "A <color value='cyan'>Quick Brown Fox</color> Jumps Over The <color value='yellow'>Lazy Dog</color>" );
- label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 0.0f, 0.0f ) );
+
+ shadowMap.Insert( "offset", Vector2( 0.0f, 0.0f ) );
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
break;
}
case MULTI_COLOR_TEXT_WITH_STYLE:
{
label.SetProperty( TextLabel::Property::TEXT, "A <color value='cyan'>Quick Brown Fox</color> Jumps Over The <color value='yellow'>Lazy Dog</color>" );
- label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 2.0f, 2.0f ) );
+
+ shadowMap.Insert( "offset", Vector2( 2.0f, 2.0f ) );
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
break;
}
case MULTI_COLOR_TEXT_WITH_EMOJI:
{
label.SetProperty( TextLabel::Property::TEXT, " \xF0\x9F\x98\x81 A <color value='cyan'>Quick Brown Fox</color> Jumps Over The <color value='yellow'>Lazy Dog</color>" );
- label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 0.0f, 0.0f ) );
+
+ shadowMap.Insert( "offset", Vector2( 0.0f, 0.0f ) );
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
break;
}
case MULTI_COLOR_TEXT_WITH_STYLE_EMOJI:
{
label.SetProperty( TextLabel::Property::TEXT, " \xF0\x9F\x98\x81 A <color value='cyan'>Quick Brown Fox</color> Jumps Over The <color value='yellow'>Lazy Dog</color>" );
- label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 2.0f, 2.0f ) );
+
+ shadowMap.Insert( "offset", Vector2( 2.0f, 2.0f ) );
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
break;
}
case SMALL_TEXT_IN_LARGE_TEXT_LABEL:
{
label.SetProperty( TextLabel::Property::TEXT, "A Quick Brown Fox Jumps Over The Lazy Dog" );
- label.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 0.0f, 0.0f ) );
+
+ shadowMap.Insert( "offset", Vector2( 0.0f, 0.0f ) );
+ label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
label.SetSize(stageSize.x, stageSize.y * 0.25f); // Set the text label in larger size
break;
}
scrollLargeButton.ClickedSignal().Connect( this, &TextScrollingExample::OnButtonClickedLarge );
CreateLabel( mLargeLabel, "A Quick Brown Fox Jumps Over The Lazy Dog", boxB, false ,scrollLargeButton );
-
CreateBox( "boxC", boxC, desktop, SCROLLING_BOX_SIZE );
boxC.SetPosition( 0.0f, -300.0f, 1.0f );
Toolkit::PushButton scrollSmallButton = Toolkit::PushButton::New();
scrollSmallButton.ClickedSignal().Connect( this, &TextScrollingExample::OnButtonClickedSmall );
CreateLabel( mSmallLabel, "Hello Text", boxC , true, scrollSmallButton );
mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLACK );
- mSmallLabel.SetProperty( TextLabel::Property::SHADOW_OFFSET, Vector2( 1.0f, 1.0f ) );
- mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::CYAN );
+ Property::Map shadowMap;
+ shadowMap.Insert( "color", Color::CYAN );
+ shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) );
+ mSmallLabel.SetProperty( TextLabel::Property::SHADOW, shadowMap );
CreateBox( "boxD", boxD, desktop, SCROLLING_BOX_SIZE );
boxD.SetPosition( 0.0f, -200.0f, 1.0f );
mToggleColor = true;
}
- mSmallLabel.SetProperty( TextLabel::Property::SHADOW_COLOR, Color::BLACK );
+ Property::Map shadowMap;
+ shadowMap.Insert( "color", Color::BLACK );
+ mSmallLabel.SetProperty( TextLabel::Property::SHADOW, shadowMap );
mSmallLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
mRtlLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );
mLargeLabel.SetProperty( TextLabel::Property::TEXT_COLOR, color );