equal
deleted
inserted
replaced
1 PointsBuffer = '' -- A string to accumulate points in |
1 HedgewarsScriptLoad("/Scripts/Draw.lua") |
2 function AddPoint(x, y, width, erase) |
|
3 PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) |
|
4 if width then |
|
5 width = bor(width,0x80) |
|
6 if erase then |
|
7 width = bor(width,0x40) |
|
8 end |
|
9 PointsBuffer = PointsBuffer .. string.char(width) |
|
10 else |
|
11 PointsBuffer = PointsBuffer .. string.char(0) |
|
12 end |
|
13 if #PointsBuffer > 245 then |
|
14 ParseCommand('draw '..PointsBuffer) |
|
15 PointsBuffer = '' |
|
16 end |
|
17 end |
|
18 function FlushPoints() |
|
19 if #PointsBuffer > 0 then |
|
20 ParseCommand('draw '..PointsBuffer) |
|
21 PointsBuffer = '' |
|
22 end |
|
23 end |
|
24 |
2 |
25 function onPreviewInit() |
3 function onPreviewInit() |
26 onGameInit() |
4 onGameInit() |
27 end |
5 end |
28 |
6 |