<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.gideros.rocks/index.php?action=history&amp;feed=atom&amp;title=TextBox_%40antix</id>
	<title>TextBox @antix - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.gideros.rocks/index.php?action=history&amp;feed=atom&amp;title=TextBox_%40antix"/>
	<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=TextBox_@antix&amp;action=history"/>
	<updated>2026-11-17T14:47:35Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.gideros.rocks/index.php?title=TextBox_@antix&amp;diff=23032&amp;oldid=prev</id>
		<title>MoKaLux at 18:04, 17 November 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=TextBox_@antix&amp;diff=23032&amp;oldid=prev"/>
		<updated>2023-11-17T18:04:49Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 18:04, 17 November 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__TOC__&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;__TOC__&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== TextBox @antix Class ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== TextBox @antix &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;&lt;/ins&gt;Class&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039; &lt;/ins&gt;===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:Textbox.png|240px]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[File:Textbox.png|240px]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l220&quot;&gt;Line 220:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 220:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== TextBox @antix Demo ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== TextBox @antix &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039;&lt;/ins&gt;Demo&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&#039;&#039;&#039; &lt;/ins&gt;===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local textBox = TextBox.new(&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;local textBox = TextBox.new(&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>MoKaLux</name></author>
	</entry>
	<entry>
		<id>https://wiki.gideros.rocks/index.php?title=TextBox_@antix&amp;diff=23029&amp;oldid=prev</id>
		<title>MoKaLux: Created page with &quot;__TOC__ === TextBox @antix Class === 240px &lt;syntaxhighlight lang=&quot;lua&quot;&gt; -- @antix TextBox = Core.class(Sprite)  function TextBox:init(options) 	-- default...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.gideros.rocks/index.php?title=TextBox_@antix&amp;diff=23029&amp;oldid=prev"/>
		<updated>2023-11-17T17:52:56Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__TOC__ === TextBox @antix Class === &lt;a href=&quot;/index.php/File:Textbox.png&quot; title=&quot;File:Textbox.png&quot;&gt;240px&lt;/a&gt; &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; -- @antix TextBox = Core.class(Sprite)  function TextBox:init(options) 	-- default...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__TOC__&lt;br /&gt;
=== TextBox @antix Class ===&lt;br /&gt;
[[File:Textbox.png|240px]]&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
-- @antix&lt;br /&gt;
TextBox = Core.class(Sprite)&lt;br /&gt;
&lt;br /&gt;
function TextBox:init(options)&lt;br /&gt;
	-- default options&lt;br /&gt;
	local props = {&lt;br /&gt;
		x	= 0,&lt;br /&gt;
		y	= 0,&lt;br /&gt;
		width = 256, -- constrain width of TextBox to this&lt;br /&gt;
		linePadding = 3, -- pixel gap between text lines&lt;br /&gt;
		color = 0xe0e0e0, -- default text color&lt;br /&gt;
		font = Font:getDefault(),&lt;br /&gt;
		text = &amp;quot;&amp;quot;,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	-- overwrite default options&lt;br /&gt;
	if options then&lt;br /&gt;
		for key, value in pairs(options) do&lt;br /&gt;
			props[key]= value&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	self.props = props&lt;br /&gt;
&lt;br /&gt;
	-- we only need one actual TextField that we will reuse to render our TextBox&lt;br /&gt;
	local brush = TextField.new(props.font, &amp;quot;&amp;quot;)&lt;br /&gt;
	self.brush = brush&lt;br /&gt;
	self:redraw()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- set new text and redraw&lt;br /&gt;
function TextBox:setText(text)&lt;br /&gt;
	local props = self.props&lt;br /&gt;
	props.text = text&lt;br /&gt;
	self:redraw()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- set new font and redraw&lt;br /&gt;
function TextBox:setFont(font)&lt;br /&gt;
	local props = self.props&lt;br /&gt;
	props.font = font&lt;br /&gt;
	self:redraw()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- redraw the textbox&lt;br /&gt;
function TextBox:redraw()&lt;br /&gt;
	local props = self.props&lt;br /&gt;
	local font = props.font&lt;br /&gt;
&lt;br /&gt;
	-- discard any previous imagery&lt;br /&gt;
	if self:getNumChildren() &amp;gt; 0 then&lt;br /&gt;
		self:removeChildAt(1)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- calculate various offsets&lt;br /&gt;
	local lineHeight = font:getLineHeight()&lt;br /&gt;
	local actualHeight = lineHeight + props.linePadding&lt;br /&gt;
	self.lineHeight = lineHeight&lt;br /&gt;
	self.actualHeight = actualHeight&lt;br /&gt;
&lt;br /&gt;
	-- split and format text&lt;br /&gt;
	local lines = self:splitText(props.text, font, props.width)&lt;br /&gt;
	self.lines = lines&lt;br /&gt;
&lt;br /&gt;
	-- create a blank canvas where we will render our text&lt;br /&gt;
	local canvas = RenderTarget.new(props.width, (#lines + 1) * actualHeight)&lt;br /&gt;
	self.canvas = canvas&lt;br /&gt;
&lt;br /&gt;
	local brush = self.brush&lt;br /&gt;
	-- render text to canvas&lt;br /&gt;
	for i = 1, #lines do&lt;br /&gt;
		local line = lines[i]&lt;br /&gt;
		local words = line.words&lt;br /&gt;
		for w = 1, #words do&lt;br /&gt;
			local word = words[w]&lt;br /&gt;
			brush:setText(word.word)&lt;br /&gt;
			brush:setTextColor(word.color)&lt;br /&gt;
			brush:setPosition(word.x + line.x, i * actualHeight)&lt;br /&gt;
			canvas:draw(brush)&lt;br /&gt;
			--print(string.format(&amp;quot;word=%s, x=%d, 0x%06x&amp;quot;, word.word, word.x, word.color))&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- create bitmap to display&lt;br /&gt;
	local bitmap = Bitmap.new(canvas) -- our canvas is the texture)&lt;br /&gt;
	bitmap:setPosition(props.x, props.y)&lt;br /&gt;
&lt;br /&gt;
	self:addChild(bitmap)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- recolor a single matching string text or all matching text if &amp;quot;all = true&amp;quot;&lt;br /&gt;
function TextBox:recolor(text, color, all)&lt;br /&gt;
	local brush = self.brush&lt;br /&gt;
	local canvas = self.canvas&lt;br /&gt;
&lt;br /&gt;
	local lineHeight = self.lineHeight&lt;br /&gt;
	local actualHeight = self.actualHeight&lt;br /&gt;
&lt;br /&gt;
	local lines = self.lines&lt;br /&gt;
	for i = 1, #lines do&lt;br /&gt;
		local line = lines[i]&lt;br /&gt;
		local words = line.words&lt;br /&gt;
		for j = 1, #words do&lt;br /&gt;
			local word = words[j]&lt;br /&gt;
			if word.word == text then&lt;br /&gt;
				canvas:clear(0x000000, 0, word.x + line.x, i * actualHeight - lineHeight, word.width, actualHeight) -- clear area where word was&lt;br /&gt;
				word.color = color&lt;br /&gt;
				brush:setText(word.word)&lt;br /&gt;
				brush:setTextColor(color)&lt;br /&gt;
				brush:setPosition(word.x + line.x, i * actualHeight)&lt;br /&gt;
				canvas:draw(brush) -- draw word&lt;br /&gt;
				if not all then&lt;br /&gt;
					return&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- this does the heavy lifting, splitting and formatting text lines and words&lt;br /&gt;
function TextBox:splitText(text, font, maxWidth)&lt;br /&gt;
	local props = self.props&lt;br /&gt;
&lt;br /&gt;
	local spaceWidth = font:getAdvanceX(&amp;quot; &amp;quot;)&lt;br /&gt;
&lt;br /&gt;
	local words = {}&lt;br /&gt;
	local lines = {}&lt;br /&gt;
	local wordList = {}&lt;br /&gt;
&lt;br /&gt;
	-- split text into words (space separated)&lt;br /&gt;
	local smatch = string.gmatch&lt;br /&gt;
	local pattern = &amp;#039;([^ ]+)&amp;#039;&lt;br /&gt;
	for str in smatch(text, pattern) do&lt;br /&gt;
		words[#words + 1] = str&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local i = 1 -- which word we are currently processing&lt;br /&gt;
	local x = 0 -- the x offset for any line of text&lt;br /&gt;
	local lineWidth = 0 -- total width of text in pixels&lt;br /&gt;
	local color = props.color -- initial color&lt;br /&gt;
	local align = &amp;quot;left&amp;quot; -- current alignment&lt;br /&gt;
	local line = &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	local function newLine()&lt;br /&gt;
		-- calculate offset for aligned text&lt;br /&gt;
		if align == &amp;quot;left&amp;quot; then&lt;br /&gt;
			x = 0&lt;br /&gt;
		elseif align == &amp;quot;right&amp;quot; then&lt;br /&gt;
			x = maxWidth - lineWidth&lt;br /&gt;
		elseif align == &amp;quot;center&amp;quot; then&lt;br /&gt;
			x = (maxWidth * 0.5) - (lineWidth * 0.5)&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		lines[#lines + 1] = {&lt;br /&gt;
			color = color,&lt;br /&gt;
			text = line,&lt;br /&gt;
			align = align,&lt;br /&gt;
			width = font:getAdvanceX(line),&lt;br /&gt;
			words = wordList,&lt;br /&gt;
			x = x,&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		lineWidth = 0&lt;br /&gt;
		line = &amp;quot;&amp;quot;&lt;br /&gt;
		wordList = {}&lt;br /&gt;
		i = i + 1&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local done = false&lt;br /&gt;
	repeat&lt;br /&gt;
		local word = words[i]&lt;br /&gt;
&lt;br /&gt;
		if word == &amp;quot;#n#&amp;quot; then&lt;br /&gt;
			-- process line feed&lt;br /&gt;
			newLine()&lt;br /&gt;
		elseif word == &amp;quot;#color#&amp;quot; then&lt;br /&gt;
			-- process text color change&lt;br /&gt;
			color = tonumber(words[i + 1])&lt;br /&gt;
			i = i + 2&lt;br /&gt;
		elseif word == &amp;quot;#align#&amp;quot; then&lt;br /&gt;
			-- process text alignment&lt;br /&gt;
			align = words[i + 1]&lt;br /&gt;
			i = i + 2&lt;br /&gt;
		else&lt;br /&gt;
			-- process a normal word&lt;br /&gt;
			local wordWidth = font:getAdvanceX(word)&lt;br /&gt;
&lt;br /&gt;
			local w = {&lt;br /&gt;
				word = word,&lt;br /&gt;
				width = wordWidth,&lt;br /&gt;
				x = lineWidth,&lt;br /&gt;
				color = color,&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			if lineWidth + wordWidth + spaceWidth &amp;gt;= maxWidth then&lt;br /&gt;
				-- container width exceeded, create a new line but skip back one word because it needs to appear on the next line&lt;br /&gt;
				i = i - 1&lt;br /&gt;
				newLine()&lt;br /&gt;
			else&lt;br /&gt;
				-- process word normally&lt;br /&gt;
				wordList[#wordList + 1] = w&lt;br /&gt;
				line = line .. &amp;quot; &amp;quot; .. word&lt;br /&gt;
				lineWidth = lineWidth + wordWidth + spaceWidth&lt;br /&gt;
				i = i + 1&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if i &amp;gt; #words then&lt;br /&gt;
			-- all words processed, append the last line and set exit condition&lt;br /&gt;
			newLine()&lt;br /&gt;
			done = true&lt;br /&gt;
		end&lt;br /&gt;
	until done&lt;br /&gt;
&lt;br /&gt;
	return lines&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== TextBox @antix Demo ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local textBox = TextBox.new(&lt;br /&gt;
	{&lt;br /&gt;
	  text = &amp;quot;This is a TextBox. It contains text that is automatically split into multiple lines&amp;quot;..&lt;br /&gt;
		&amp;quot; and of course every #color# 0x0066ff word #color# 0x33ff55 can #color# 0x33ffff be&amp;quot;..&lt;br /&gt;
		&amp;quot; #color# 0xff66ff individually #color# 0x00ff00 colored.&amp;quot;..&lt;br /&gt;
		&amp;quot; #color# 0xffffff Then there are line breaks which make life...&amp;quot;..&lt;br /&gt;
		&amp;quot; #n# #n# so much easier!!!&amp;quot;..&lt;br /&gt;
		&amp;quot; #n# #n# #color# 0xf00000 #align# right Lets align the text to the right #n#&amp;quot;..&lt;br /&gt;
		&amp;quot; It looks pretty good this way #n# #n# #align# center #color# 0x4080d0 but centered text #n# is always good&amp;quot;..&lt;br /&gt;
		&amp;quot; also #n# #n# #color# 0xf0f0f0 #align# left Well that&amp;#039;s a wrap :)&amp;quot;,&lt;br /&gt;
	}&lt;br /&gt;
)&lt;br /&gt;
stage:addChild(textBox)&lt;br /&gt;
-- recolor all occurences of &amp;quot;is&amp;quot; to the color magenta&lt;br /&gt;
textBox:recolor(&amp;quot;is&amp;quot;, 0xff00ff, true)&lt;br /&gt;
-- recolor the first occurence of &amp;quot;the&amp;quot; to the color cyan&lt;br /&gt;
textBox:recolor(&amp;quot;the&amp;quot;, 0x00ffff)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;[[UI Text]]&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
{{GIDEROS IMPORTANT LINKS}}&lt;/div&gt;</summary>
		<author><name>MoKaLux</name></author>
	</entry>
</feed>