tests/lua/twothousandmines.lua
changeset 10609 15f2908113a1
parent 10552 15d1e24a8c72
child 10611 58cad46782ff
equal deleted inserted replaced
10607:532d43f3d6f9 10609:15f2908113a1
     1 -- spawns 2000 mines in a bit to see if engine can deal with it
       
     2 
     1 
     3  -- taken from http://code.google.com/p/hedgewars/wiki/LuaDrawing
     2 HedgewarsScriptLoad("/Scripts/Draw.lua")
     4  PointsBuffer = ''  -- A string to accumulate points in
       
     5  function AddPoint(x, y, width, erase)
       
     6      PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff))
       
     7      if width then
       
     8          width = bor(width,0x80)
       
     9          if erase then
       
    10              width = bor(width,0x40)
       
    11          end
       
    12          PointsBuffer = PointsBuffer .. string.char(width)
       
    13      else
       
    14          PointsBuffer = PointsBuffer .. string.char(0)
       
    15      end
       
    16      if #PointsBuffer > 245 then
       
    17          ParseCommand('draw '..PointsBuffer)
       
    18          PointsBuffer = ''
       
    19      end
       
    20  end
       
    21  function FlushPoints()
       
    22      if #PointsBuffer > 0 then
       
    23          ParseCommand('draw '..PointsBuffer)
       
    24          PointsBuffer = ''
       
    25      end
       
    26  end
       
    27 
       
    28 
     3 
    29 local ta_pointsize = 63
     4 local ta_pointsize = 63
    30 local ta_radius = (ta_pointsize * 10 + 6) / 2
     5 local ta_radius = (ta_pointsize * 10 + 6) / 2
    31 
     6 
    32 local sqrttwo = math.sqrt(2)
     7 local sqrttwo = math.sqrt(2)