OpenFL/Starling text input


What do you use to text input on OpenFL/Starling project?
On AIR we have Feather library over Starling.

I found
But have two problems:

  1. Font is always the same. I try different fonts (bitmap, ttf) but no result.

  2. I can’t use non ASCII characters. Always only English letters are displayed.

What can you recommend? What do you use? Can I use OpenFL TextField over Starling DisplayObject?

P.S. I interested in html5 target.

Hi, I use FeathersUI over Starling for everything that doesn’t need to be located in the game display itself (like a character name floating over the character, a health bar, damage numbers etc)

On your screenshot the text displayed looks like the default “MINI” bitmap font

Maybe have a look here ? The Starling Manual
It’s for the as3 version but everything should be the same

Bitmap fonts have to be registered with TextField.registerCompositor(bmpFont, name)

System or embedded fonts should be available using their name, you can list available fonts with openfl’s Font class : Font.enumerateFonts()

  1. How do you use FeathersUI over Starling? You calculate absolute coordinates and add elements to Starling.current.nativestage?

  2. Starling AssetManager do TextField.registerCompositor(bmpFont, name) internally.
    But I found that ‘TextDisplay’ class need similar method FontRegistry.registerBitmapFont(bitmapFont, fontName); After I add this - everything works!

Now question is: can ‘TextDisplay’ work with embedded ttf fonts or only Bitmap fonts?)
May be someone has used ‘TextDisplay’ class.

  1. Depends on what we’re talking about : displaying a popup at the center of the screen doesn’t need anything from starling for example, same with having a panel with buttons on a side of the screen. If you need a UI element to appear near a character in your game then yeah you will need some
    <DisplayObject>.localToGlobal() to retrieve the correct location. You can also use Lib.stage to access the regular (non-starling) Stage

  2. great :slight_smile: Thanks for digging this lib btw, it seems to have interesting stuff I’ll try to look into it when I get some free time.

From the quick glance I took yesterday I believe it only works with BitmapFont. It seems like it should be able to generate a BitmapFont out of a regular font file, but you can also do that yourself using BMFont for example ( BMFont - ) - I think there are a few tools mentionned in the starling manual, should be a bit below where my link takes you.

edit : not Lib.stage but Lib.current.stage