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
|
local GUI = {}
function GUI.drawPolygon(polygon)
if polygon.Colors then
love.graphics.setColor(unpack(polygon.Colors))
end
if polygon.LineWidth then
love.graphics.setLineWidth(polygon.LineWidth*(Window.width+Window.height)/2)
end
if polygon.Type == "rectangle" then
love.graphics.rectangle(polygon.DrawMode, polygon.Position.x*Window.width, polygon.Position.y*Window.height,
polygon.Dimension.width*Window.width, polygon.Dimension.height*Window.height)
elseif polygon.Type == "polygon" then
love.graphics.polygon(polygon.DrawMode, polygon.Position.x1*Window.width, polygon.Position.y1*Window.height,
polygon.Position.x2*Window.width, polygon.Position.y2*Window.height,
polygon.Position.x3*Window.width, polygon.Position.y3*Window.height,
polygon.Position.x4*Window.width, polygon.Position.y4*Window.height)
elseif polygon.Type == "line" then
love.graphics.line(polygon.Position.x1*Window.width, polygon.Position.y1*Window.height,
polygon.Position.x2*Window.width, polygon.Position.y2*Window.height)
elseif polygon.Type == "print" then
love.graphics.print(polygon.Text, polygon.Position.x*Window.width, polygon.Position.y*Window.height)
end
end
return GUI
|