-
Notifications
You must be signed in to change notification settings - Fork 6
Working with text
Working with text is done using bitmap fonts. For every font family, style or color you need a different font file.
See all supported apps that create BMfont formatted font files: Font tools
In the BMFont-tool, use these settings:
- File → Font settings
- Choose font
- Choose size
- Render from TrueType outline (if you want smooth fonts)
-
File → Export settings
- Bit depth: 32
- Preset: black text with alpha
- Font descriptor: Text
- Texture: Png
-
File → Save bitmap font as..
- Put in your Flambe project under
./assets/global/myFontName.fnt
folder
- Put in your Flambe project under
var font = new Font(pack, "myFontName");
var myTextSprite:TextSprite = new TextSprite(font, "Hello world!");
myTextSprite.align = TextAlign.Left;
owner.addChild(new Entity().add(myTextSprite));
// change the text using .text property:
myTextSprite.text = "Flambe";
Tip: To use newlines, use \n in your text.
myTextSprite.letterSpacing._ = 10;
myTextSprite.lineSpacing._ = 50;
Default there is no word-wrapping. The wrapWidth
property sets the maximum available width of this text before word wrapping to a new line.
myTextSprite.wrapWidth._ = 500;
Download a bitmap font (Arial 18px)
If you add some 'padding' (not 'spacing') in the export options, you can decorate the outputted .png-file in Photoshop with some colors/effects/gradients. For example, Flambe does not natively support filters like a shadows, glows or gradients. You can bake this inside your bitmap.
For the gradients, Its not simple to add them with photoshop, unless you use the "equalize the cell heights" in the export options. Then all chars have the same height and is a bit easier to add the gradients. Of course, the texture will be a bit bigger in that case, since there is a bit more whitespace.
Looking for a demo project with text? See https://github.com/aduros/flambe-demos/tree/master/text
Documentation guide for Flambe - Targeted to version 4.0+
Flambe | Installation | Demo projects | Showcase | API Reference | Forum
Flambe is MIT licensed and available for free. Feel free to contribute!
- Home / Installation
- Entity / Components
- Core
- Assets
- Publish your game
- Other
- Editors
- Plugins, tools, extensions
- Help
- More Flambe