Community Curator/Source/TSWRes ObjectsMaterial

-- Material Objects --

-- Square function ObjRes.Square(CorTab, X, Y, Size, RotRad, Mat, k)  draw.fillpolygon(X, Y, Size, 4, RotRad + (math.pi*.25), ObjMaterials[Mat] or draw.brown) draw.polygon(X, Y, Size, 4, RotRad + (math.pi*.25), ObjMaterialsBorders[Mat] or draw.black) if ObjSelected == k then draw.polygon(X, Y, Size, 4, RotRad + (math.pi*.25), PlayCol1) end end

-- Triangle function ObjRes.Triangle(CorTab, X, Y, Size, RotRad, Mat, k)  draw.fillpolygon(X, Y, Size, 3, RotRad + (math.pi*.5), ObjMaterials[Mat] or draw.brown) draw.polygon(X, Y, Size, 3, RotRad + (math.pi*.5), ObjMaterialsBorders[Mat] or draw.black) if ObjSelected == k then draw.polygon(X, Y, Size, 3, RotRad + (math.pi*.5), PlayCol1) end end

-- Pentagon function ObjRes.Pentagon(CorTab, X, Y, Size, RotRad, Mat, k)  draw.fillpolygon(X, Y, Size, 5, RotRad + (math.pi*.5), ObjMaterials[Mat] or draw.brown) draw.polygon(X, Y, Size, 5, RotRad + (math.pi*.5), ObjMaterialsBorders[Mat] or draw.black) if ObjSelected == k then draw.polygon(X, Y, Size, 5, RotRad + (math.pi*.5), PlayCol1) end end

-- Hexagon function ObjRes.Hexagon(CorTab, X, Y, Size, RotRad, Mat, k)  draw.fillpolygon(X, Y, Size, 6, RotRad + (math.pi*.5), ObjMaterials[Mat] or draw.brown) draw.polygon(X, Y, Size, 6, RotRad + (math.pi*.5), ObjMaterialsBorders[Mat] or draw.black) if ObjSelected == k then draw.polygon(X, Y, Size, 6, RotRad + (math.pi*.5), PlayCol1) end end

-- Octagon function ObjRes.Octagon(CorTab, X, Y, Size, RotRad, Mat, k)  draw.fillpolygon(X, Y, Size, 8, RotRad + (math.pi*.5), ObjMaterials[Mat] or draw.brown) draw.polygon(X, Y, Size, 8, RotRad + (math.pi*.5), ObjMaterialsBorders[Mat] or draw.black) if ObjSelected == k then draw.polygon(X, Y, Size, 8, RotRad + (math.pi*.5), PlayCol1) end end

-- Five Pointed Star function ObjRes.FivePointStar(CorTab, X, Y, Size, RotRad, Mat, k)  draw.fillstar(X, Y, Size*.5, Size, 5, RotRad + (math.pi*.5), ObjMaterials[Mat] or draw.brown) draw.star(X, Y, Size*.5, Size, 5, RotRad + (math.pi*.5), ObjMaterialsBorders[Mat] or draw.black) if ObjSelected == k then draw.star(X, Y, Size*.5, Size, 5, RotRad + (math.pi*.5), PlayCol1) end end

-- Six Pointed Star function ObjRes.SixPointStar(CorTab, X, Y, Size, RotRad, Mat, k)  draw.fillstar(X, Y, Size*.5, Size, 6, RotRad + (math.pi*.5), ObjMaterials[Mat] or draw.brown) draw.star(X, Y, Size*.5, Size, 6, RotRad + (math.pi*.5), ObjMaterialsBorders[Mat] or draw.black) if ObjSelected == k then draw.star(X, Y, Size*.5, Size, 6, RotRad + (math.pi*.5), PlayCol1) end end

-- Circle function ObjRes.Circle(CorTab, X, Y, Size, RotRad, Mat, k)  draw.fillcircle(X, Y, Size, ObjMaterials[Mat] or draw.brown) draw.circle(X, Y, Size, ObjMaterialsBorders[Mat] or draw.black) if ObjSelected == k then draw.circle(X, Y, Size, PlayCol1) end end

-- For Custom Objects function ObjRes.Custom(CorTab, X, Y, Size, RotRad, Mat, k)  if not Size then Size = 32 end local Line, filltriangle = draw.line, draw.filltriangle local Col if type(Mat) == "table" then Col = Mat else Col = ObjMaterials[Mat] or draw.brown end --setmetatable(Col, Col255MT) -- use local Col2 = ObjMaterialsBorders[Mat] or draw.black --print("Size: "..tostring(Size), "k: "..tostring(k)) for k, v in ipairs(CorTab) do     local FCor = CorTab[k-1] or CorTab[#CorTab] local SCor = CorTab[k] local TCor = CorTab[k+1] or CorTab[1] filltriangle((FCor[1]*Size)+X, (FCor[2]*Size)+Y, (SCor[1]*Size)+X, (SCor[2]*Size)+Y, (TCor[1]*Size)+X, (TCor[2]*Size)+Y, Col) Line((FCor[1]*Size)+X, (FCor[2]*Size)+Y, (SCor[1]*Size)+X, (SCor[2]*Size)+Y, Col2) end end

return