Exemple #1
0
        protected override async Task LoadContent()
        {
            await base.LoadContent();

            border = new Border { Width = 200, Height = 150, Content = new Button { NotPressedImage = new Sprite(Asset.Load<Texture>("uv")), DepthAlignment = DepthAlignment.Back}};
            border.SetCanvasPinOrigin(new Vector3(0.5f));
            
            border.BackgroundColor = Color.Red;

            ResetBorderElement();

            UIComponent.RootElement = new Canvas { Children = { border } };
        }
 private void DrawBorder(Border border, ref Vector3 offsets, ref Vector3 borderSize, UIRenderingContext context)
 {
     var worldMatrix = border.WorldMatrixInternal;
     worldMatrix.M41 += worldMatrix.M11 * offsets.X + worldMatrix.M21 * offsets.Y + worldMatrix.M31 * offsets.Z;
     worldMatrix.M42 += worldMatrix.M12 * offsets.X + worldMatrix.M22 * offsets.Y + worldMatrix.M32 * offsets.Z;
     worldMatrix.M43 += worldMatrix.M13 * offsets.X + worldMatrix.M23 * offsets.Y + worldMatrix.M33 * offsets.Z;
     Batch.DrawCube(ref worldMatrix, ref borderSize, ref border.BorderColorInternal, context.DepthBias);
 }