1 ObjectList = {} |
1 ObjectList = {} |
2 PointsBuffer = '' -- A string to accumulate points in |
2 |
|
3 HedgewarsScriptLoad("/Scripts/Draw.lua") |
3 |
4 |
4 -- Overall padding for roping freedom |
5 -- Overall padding for roping freedom |
5 Padding = 430 |
6 Padding = 430 |
6 |
|
7 function AddPoint(x, y, width, erase) |
|
8 PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) |
|
9 if width then |
|
10 width = bor(width,0x80) |
|
11 if erase then |
|
12 width = bor(width,0x40) |
|
13 end |
|
14 PointsBuffer = PointsBuffer .. string.char(width) |
|
15 else |
|
16 PointsBuffer = PointsBuffer .. string.char(0) |
|
17 end |
|
18 if #PointsBuffer > 245 then |
|
19 ParseCommand('draw '..PointsBuffer) |
|
20 PointsBuffer = '' |
|
21 end |
|
22 end |
|
23 function FlushPoints() |
|
24 if #PointsBuffer > 0 then |
|
25 ParseCommand('draw '..PointsBuffer) |
|
26 PointsBuffer = '' |
|
27 end |
|
28 end |
|
29 |
7 |
30 -- This could probably use less points and more precision |
8 -- This could probably use less points and more precision |
31 -- 700x700 for object space |
9 -- 700x700 for object space |
32 function DrawStar(x, y, d, f) |
10 function DrawStar(x, y, d, f) |
33 -- default scale is 700x700 or so |
11 -- default scale is 700x700 or so |