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()
How do you use FeathersUI over Starling? You calculate absolute coordinates and add elements to Starling.current.nativestage?
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.
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
great 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 - AngelCode.com ) - I think there are a few tools mentionned in the starling manual, should be a bit below where my link takes you.
Hi!
Now I need to give the option to enter emoji in Starling game on html5 target)
So TextDisplay class (works with bitmap fonts only) does not suit me(
I need static textfield position inside my game gui:
What can you recommend? FeatherUI is a pretty big lib for only one ‘textinput’ task.
And one other question)
Is there method to compute coordinates from Starling stage to OpenFL stage coordinate system (in view of Starling viewport, scalefactor, etc)?
Thx!
I don’t have an easy solution to offer here, I never had to do that. Bitmap font doesn’t sound like a bad idea though ? You could probably associate each emoji with a character code, and parse user’s input to replace the emoji code with the character code for that emoji picture ?
Why do you want to get rid of your TextDisplay exactly ? Is it because it is misplaced in your screenshot ? Or some other reason ?
Using regular TextField I would try something with htmlText and image tag
I don’t remember seeing a function for this but could totally be wrong
It should not be hard to do though :
make sure you have global coordinates (use DisplayObject.localToGlobal if needed)