2 if not
object or not func then
return func end
3 return function(a, b, c, d)
4 return func(
object, a, b, c, d)
9 return function(mode, verts)
11 while index <=
#verts do
12 func_draw_line(verts[index - 3], verts[index - 2], verts[index - 1], verts[index])
19 if not func_draw_triangle then
23 local point = function(x, y, px, py, scale, angle, ox, oy)
24 local xx = x + ((ox - px) * -scale *
std.math.cos(angle)) - ((ox - py) * -scale *
std.math.sin(angle))
25 local yy = y + ((oy - px) * -scale *
std.math.sin(angle)) + ((oy - py) * -scale *
std.math.cos(angle))
29 return function(engine_mode, verts, x, y, scale, angle, ox, oy)
31 return func_draw_poly(engine_mode, verts, x, y, scale, angle, ox, oy)
38 local x1, y1 = point(x, y, verts[1], verts[2], scale, angle, ox, oy)
39 local x2, y2 = point(x, y, verts[3], verts[4], scale, angle, ox, oy)
40 local x3, y3 = point(x, y, verts[5], verts[6], scale, angle, ox, oy)
42 return func_draw_triangle(engine_mode, x1, y1, x2, y2, x3, y3)
47 return function (engine_mode, verts, x, y, scale, angle, ox, oy)
48 if #verts < 6 or #verts % 2 ~= 0 then
return end
49 local mode = modes and modes[engine_mode + 1] or engine_mode
50 local rotated =
std.math.cos and angle and angle ~= 0
54 if repeats and repeats[engine_mode + 1] then
55 verts[#verts + 1] = verts[1]
56 verts[#verts + 1] = verts[2]
59 if x and y and not rotated then
64 while index <= #verts
do
65 if index % 2 ~= 0 then
66 verts2[index] = x + (verts[index] * scale)
68 verts2[index] = y + (verts[index] * scale)
72 func_draw_poly(mode, verts2)
76 while index < #verts
do
77 local px = verts[index]
78 local py = verts[index + 1]
79 local xx = x + ((ox - px) * -scale *
std.math.cos(angle)) - ((ox - py) * -scale *
std.math.sin(angle))
80 local yy = y + ((oy - px) * -scale *
std.math.sin(angle)) + ((oy - py) * -scale *
std.math.cos(angle))
82 verts2[index + 1] = yy
85 func_draw_poly(mode, verts2)
87 func_draw_poly(mode, verts)
95 local draw_poly2 = config.poly2 or
decorator_poly(draw_poly,
std, config.modes, config.repeats)
100 std.draw.poly = draw_verts
102 return {poly=
std.draw.poly}
local function decorator_poly(func_draw_poly, std, modes, repeats)
local function decorator_poo(object, func)
local function decorator_triangle(func_draw_poly, std, func_draw_triangle)
local function install(std, game, application, config)
local function decorator_line(func_draw_line)