1

Torque 引擎有一个很好的标记语言 TorqueML(见下文,复制自garagegames 论坛中的帖子)。它可以将一些简单的布局和格式信息合并到纯文本中,这些信息可用于在游戏中构建用于帮助或对话框的文本小部件。

我想知道是否有人可以提出一种最有效的方法来在 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.  
4

1 回答 1

3

作为起点,HaxeFlixel 的 FlxText.hx 中已经提供了一个基本功能,可让您应用简单的标记:

https://github.com/HaxeFlixel/flixel/blob/dev/flixel/text/FlxText.hx#L274

于 2016-01-11T18:53:17.450 回答