Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
ShadowText — Gideros Forum

ShadowText

jdbcjdbc Member
edited January 2013 in Code snippets
I am not sure if this code snippet is already published.

Anyway I provide this code to display text with shadow with two methods to change main color and shadow color

ShadowText = Core.class(Sprite)

-- Constructor
function ShadowText:init(font, text)

--Shadow text
local text_shadow = TextField.new(font, text)
text_shadow:setPosition(1,2)
text_shadow:setTextColor(0xee0000) --> Black Colour
self.text_shadow = text_shadow
self:addChild(text_shadow)

--Normal text
local text_normal = TextField.new (font, text)
text_normal:setTextColor(0xffffcc)
self.text_normal = text_normal
self:addChild(text_normal)

end

function ShadowText:setNormalColor(color)
self.text_normal:setTextColor(color)
end

function ShadowText:setShadowColor(color)
self.text_shadow:setTextColor(color)
end

function ShadowText:setText(text)
self.text_normal:setText(text)
self.text_shadow:setText(text)
end

:ar!

Likes: Teranth

+1 -1 (+1 / -0 )Share on Facebook

Comments

Sign In or Register to comment.