forked from goosefx/mexico
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EmbossedText.lua
43 lines (38 loc) · 945 Bytes
/
EmbossedText.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
local mexico = require "mexico"
--
-- Mexico wrapper for a corona embossed text.
--
local EmbossedText = mexico.class(mexico.DisplayObject)
--
-- Magic new function, since corona creates the object
-- and not we.
--
EmbossedText.new = function(styles)
local l = styles.left or 0
local t = styles.top or 0
local w = styles.width
local h = styles.height
local f = styles.font or native.systemFont
local s = styles.size or 20
local x = styles.text
if w then
return display.newEmbossedText(x, l, t, w, h, f, s)
else
return display.newEmbossedText(x, l, t, f, s)
end
end
--
-- Constructor
--
function EmbossedText:init(styles)
local styles = table.mexico.clone(styles)
styles["text"] = nil
styles["left"] = nil
styles["top"] = nil
styles["width"] = nil
styles["height"] = nil
styles["font"] = nil
styles["size"] = nil
mexico.DisplayObject.init(self, styles)
end
return EmbossedText