equal
deleted
inserted
replaced
1 |
1 |
2 -- taken from http://code.google.com/p/hedgewars/wiki/LuaDrawing |
2 HedgewarsScriptLoad("/Scripts/Draw.lua") |
3 PointsBuffer = '' -- A string to accumulate points in |
|
4 function AddPoint(x, y, width, erase) |
|
5 PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) |
|
6 if width then |
|
7 width = bor(width,0x80) |
|
8 if erase then |
|
9 width = bor(width,0x40) |
|
10 end |
|
11 PointsBuffer = PointsBuffer .. string.char(width) |
|
12 else |
|
13 PointsBuffer = PointsBuffer .. string.char(0) |
|
14 end |
|
15 if #PointsBuffer > 245 then |
|
16 ParseCommand('draw '..PointsBuffer) |
|
17 PointsBuffer = '' |
|
18 end |
|
19 end |
|
20 function FlushPoints() |
|
21 if #PointsBuffer > 0 then |
|
22 ParseCommand('draw '..PointsBuffer) |
|
23 PointsBuffer = '' |
|
24 end |
|
25 end |
|
26 |
|
27 |
3 |
28 local ta_pointsize = 63 |
4 local ta_pointsize = 63 |
29 local ta_radius = (ta_pointsize * 10 + 6) / 2 |
5 local ta_radius = (ta_pointsize * 10 + 6) / 2 |
30 |
6 |
31 local sqrttwo = math.sqrt(2) |
7 local sqrttwo = math.sqrt(2) |