HorizontalAlignment
Introduction
Example - Right-Alignment in a Parent
// Initialize
var leftAligned = new TextRuntime();
leftAligned.AddToRoot();
leftAligned.Text = "Hi, I am some text that is left aligned, even if I line wrap";
leftAligned.HorizontalAlignment = RenderingLibrary.Graphics.HorizontalAlignment.Left;
leftAligned.Width = 100;
leftAligned.WidthUnits = Gum.DataTypes.DimensionUnitType.Absolute;
leftAligned.X = 50;
leftAligned.Y = 100;
var centerAligned = new TextRuntime();
centerAligned.AddToRoot();
centerAligned.Text = "Hi, I am some text that is center aligned, even if I line wrap";
centerAligned.HorizontalAlignment = RenderingLibrary.Graphics.HorizontalAlignment.Center;
centerAligned.Width = 100;
centerAligned.WidthUnits = Gum.DataTypes.DimensionUnitType.Absolute;
centerAligned.X = 250;
centerAligned.Y = 100;
var rightAligned = new TextRuntime();
rightAligned.AddToRoot();
rightAligned.Text = "Hi, I am some text that is right aligned, even if I line wrap";
rightAligned.HorizontalAlignment = RenderingLibrary.Graphics.HorizontalAlignment.Right;
rightAligned.Width = 100;
rightAligned.WidthUnits = Gum.DataTypes.DimensionUnitType.Absolute;
rightAligned.X = 450;
rightAligned.Y = 100;
HorizontalAlignment, Anchor, and Dock
Last updated
Was this helpful?

