Torque引擎有一个很好的标记语言TorqueML(见下文,从a post in the garagegames forum复制)。它可以在纯文本中包含一些简单的布局和格式信息,可用于在游戏中构建文本小部件以获得帮助或对话框。
我想知道是否可以建议一种在Haxe中构建/获取相同功能的最有效方法(特别是在HaxeFlixel框架内)。
以下是Torque中提供的标记语言信息,供参考:
<font:fontName:fontSize> - sets the font and fontsize as indicated. Example: <font:Arial Bold:20>
<tag:???> - not sure what this does
<color:rrggbb> - sets text color in hex format. Example: <color:ff0000> will display red text
<bitmap:filePath> - displays a bitmap image indicated by the file path. Example: <bitmap:demo/client/ui/seperator>
<spush> - saves the current text formatting so that temporary changes to formatting can be made. Used with spop.
<spop> - restores the previously saved text formatting. Used with spush. See the file "3. Gui Editor.hlf" included with the TGE demo for an example of usage.
<sbreak> - not sure what this does
<just:left> - left justify
<just:right> - right justify
<just:center> - center justify
<a:ExternalURL>LinkTitle</a> - inserts a hyperlink into the text which will open the user's browser.
The external URL does not need the "http://" format. Example: <a:www.garagegames.com>Garage Games Website</a>
<lmargin: ##> - sets the left margin
<lmargin%: ##> - sets the left margin (not sure what the % does)
<rmargin: ##> - sets the right margin
<rmargin%: ##> - sets the right margin (not sure what the % does)
<clip:> - not sure what this does
<div:> - not sure what this does
<tab:##(,##,etc)> - sets the tab stops (multiple tabs are separated by commas)
- Breaks the current line and begins a new one.
答案 0 :(得分:3)
作为一个起点,HaxeFlixel的FlxText.hx中已经有一个基本功能可以让你应用简单的标记:
https://github.com/HaxeFlixel/flixel/blob/dev/flixel/text/FlxText.hx#L274