mirror of
https://github.com/stride3d/stride
synced 2026-05-24 10:19:21 +00:00
36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
// Copyright (c) Xenko contributors (https://xenko.com) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
|
|
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
|
|
using Xenko.Core.Mathematics;
|
|
using Xenko.Engine;
|
|
using Xenko.Graphics;
|
|
using Xenko.UI;
|
|
using Xenko.UI.Controls;
|
|
using Xenko.UI.Panels;
|
|
|
|
namespace PhysicsSample
|
|
{
|
|
/// <summary>
|
|
/// The script in charge of displaying the UI
|
|
/// </summary>
|
|
public class GuiScript : StartupScript
|
|
{
|
|
public SpriteFont Font;
|
|
|
|
public override void Start()
|
|
{
|
|
base.Start();
|
|
|
|
var textBlock = new TextBlock
|
|
{
|
|
Text = "Shoot the cubes!",
|
|
Font = Font,
|
|
TextColor = Color.White,
|
|
TextSize = 60
|
|
};
|
|
textBlock.SetCanvasPinOrigin(new Vector3(0.5f, 0.5f, 0));
|
|
textBlock.SetCanvasRelativePosition(new Vector3(0.5f, 0.9f, 0f));
|
|
|
|
Entity.Get<UIComponent>().Page = new UIPage { RootElement = new Canvas { Children = { textBlock } } };
|
|
}
|
|
}
|
|
}
|