Forum Libraries, Components, and Plugins

Newbie: Simple UI Text sample does not display in Android App?

I have created an Android version of the Introduction Uhro Tutorial. The Box.mdl gets displayed by the Hello UI text does not. So I see the Box Rotating, but don't see the "Hello from Urho" UI text, on my Nexus 4 Android device. The Hello World Sample in the overall Feature Samples works OK, as do all the other sample demos.

I copied Font.ttf from SamplyGame into my Assets/Data/Fonts file, and set to Build Action = AndroidAsset, with Copy to output Directory = Copy If Newer, in just the same way as the Box.mdl under the Models Directory.

I invoke mu game via UrhoSurface.RunInActivity();
and then within the Start() method I use the stanard sample code:

  var helloText = new  Text()
            Value = "Hello World from MySample",
            HorizontalAlignment = HorizontalAlignment.Center,
            VerticalAlignment = VerticalAlignment.Center
        helloText.SetColor(new Color(0f, 1f, 1f));
            font: ResourceCache.GetFont("Fonts/Font.ttf"),
            size: 30);

The rest of the Sample works OK, Box easing out and then rotating.

Best Answer


  • JulianWinterJulianWinter GBMember ✭✭
    edited April 2016

    Yes Many Thanks That helps, I now invoke by
    UrhoSurface.RunInActivity(new ApplicationOptions("Data"));

    But I discovered I was also missing a Urho.Application constructor in my Uhro Application class

         public MyGame(ApplicationOptions options = null) : base(options) { }

    Which was not obvious in the sample code. I guess this sets up the UI.Root, required to set up the Child UI elements,

    Many Thanks. Now moving on to adding 3D Terrains !

Sign In or Register to comment.