LuaDrawing.wiki
changeset 257 3d03892b7545
parent 256 0b93b3ec3ebf
child 258 9c815950568d
equal deleted inserted replaced
256:0b93b3ec3ebf 257:3d03892b7545
    31         ParseCommand('draw '..PointsBuffer)
    31         ParseCommand('draw '..PointsBuffer)
    32         PointsBuffer = ''
    32         PointsBuffer = ''
    33     end
    33     end
    34 end
    34 end
    35 </code>
    35 </code>
    36 AddPoint takes an x and y location for the point, a size (required to start a line) and erase (whether the line is erasing from the map)
    36 AddPoint takes an x and y location for the point, a size (required to start a line) and erase (whether the line is erasing from the map).  The size is the "width" value from [[DrawnMapFormat]].
    37 FlushPoints writes out any values from PointsBuffer that had not already been sent to the engine.  It would be called at the end of a drawing session.
    37 
       
    38 FlushPoints writes out any values from PointsBuffer that have not already been sent to the engine.
       
    39 It would be called at the end of a drawing session.
    38 
    40 
    39 A simple example below.
    41 A simple example below.
    40 
    42 
    41 <code lang="lua">
    43 <code lang="lua">
    42 function onGameInit()
    44 function onGameInit()
    68 end
    70 end
    69 </code>
    71 </code>
    70 The first set of AddPoints draws a large X and erases the centre.
    72 The first set of AddPoints draws a large X and erases the centre.
    71 The following loop draws a set of nested points, alternating erasure and fill, which results in a set of concentric circles.
    73 The following loop draws a set of nested points, alternating erasure and fill, which results in a set of concentric circles.
    72 The 2nd loop draws a web of lines and frames it using some final AddPoints.
    74 The 2nd loop draws a web of lines and frames it using some final AddPoints.
       
    75 
       
    76 Another brief example.
       
    77 <code lang="lua">
       
    78     for i = 200,2000,600 do
       
    79         AddPoint(1,i,63)
       
    80         AddPoint(4000,i)
       
    81     end
       
    82     for i = 500,3500,1000 do
       
    83         AddPoint(i,1000,63,true)
       
    84     end
       
    85 </code>
       
    86 This one fills the map with solid land, and draws 3 circular erased points in it.