-
Notifications
You must be signed in to change notification settings - Fork 3
/
DisplayFactory.lua
68 lines (56 loc) · 1.57 KB
/
DisplayFactory.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
local mexico = require "mexico"
--
-- Mexico wrapper for a corona display factory functions.
--
local DisplayFactory = {}
function DisplayFactory:newGroup(styles)
local group = mexico.Group(styles)
if self then self:insert(group) end
return group
end
function DisplayFactory:newRect(styles)
local rect = mexico.Rect(styles)
if self then self:insert(rect) end
return rect
end
function DisplayFactory:newRoundedRect(styles)
local roundedRect = mexico.RoundedRect(styles)
if self then self:insert(roundedRect) end
return roundedRect
end
function DisplayFactory:newCircle(styles)
local circle = mexico.Circle(styles)
if self then self:insert(circle) end
return circle
end
function DisplayFactory:newLine(styles)
local line = mexico.Line(styles)
if self then self:insert(line) end
return line
end
function DisplayFactory:newImage(styles)
local image = mexico.Image(styles)
if self then self:insert(image) end
return image
end
function DisplayFactory:newImageRect(styles)
local imageRect = mexico.ImageRect(styles)
if self then self:insert(imageRect) end
return imageRect
end
function DisplayFactory:newText(styles)
local text = mexico.Text(styles)
if self then self:insert(text) end
return text
end
function DisplayFactory:newRetinaText(styles)
local retinaText = mexico.RetinaText(styles)
if self then self:insert(retinaText) end
return retinaText
end
function DisplayFactory:newEmbossedText(styles)
local embossedText = mexico.EmbossedText(styles)
if self then self:insert(embossedText) end
return embossedText
end
return DisplayFactory