1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 14:35:45 +00:00

Hello world urho

This commit is contained in:
Yan Maniez 2019-07-27 11:55:16 +02:00
parent d4bb055dad
commit 3e464f0516
2 changed files with 37 additions and 1 deletions

View file

@ -3,7 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:skviews="clr-namespace:SkiaSharp.Views.Forms;assembly=SkiaSharp.Views.Forms"
xmlns:pickers="clr-namespace:AideDeJeu.Views.Pickers"
x:Class="AideDeJeu.Views.DicesPage">
xmlns:urho="clr-namespace:Urho.Forms;assembly=UrhoSharp.Forms"
x:Class="AideDeJeu.Views.DicesPage" Appearing="ContentPage_Appearing">
<ContentPage.Content>
<StackLayout>
<StackLayout Orientation="Horizontal">
@ -66,6 +67,8 @@
<skviews:SKCanvasView x:Name="CanvasDices" Margin="15" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" PaintSurface="SKCanvasView_PaintSurface">
</skviews:SKCanvasView>
<urho:UrhoSurface x:Name="HelloWorldUrhoSurface" VerticalOptions="FillAndExpand" />
</StackLayout>
</ContentPage.Content>
</ContentPage>

View file

@ -82,5 +82,38 @@ namespace AideDeJeu.Views
strokeFont.Dispose();
strokePaint.Dispose();
}
private async void ContentPage_Appearing(object sender, EventArgs e)
{
await HelloWorldUrhoSurface.Show<HelloWorld>(new Urho.ApplicationOptions(assetsFolder: null));
}
}
public class HelloWorld : Urho.Application
{
public HelloWorld(Urho.ApplicationOptions options) : base(options)
{
}
protected override void Start()
{
base.Start();
CreateText();
}
private void CreateText()
{
// Create Text Element
var text = new Urho.Gui.Text()
{
Value = "Hello World!",
HorizontalAlignment = Urho.Gui.HorizontalAlignment.Center,
VerticalAlignment = Urho.Gui.VerticalAlignment.Center
};
text.SetColor(Urho.Color.Cyan);
text.SetFont(font: ResourceCache.GetFont("Fonts/Anonymous Pro.ttf"), size: 30);
// Add to UI Root
UI.Root.AddChild(text);
}
}
}