LuaDrawing.wiki
changeset 1903 22f677d419ed
parent 1396 d0f79e828581
equal deleted inserted replaced
1902:b96fb9c3e3c0 1903:22f677d419ed
    40 
    40 
    41 The final line `onPreviewInit = onGameInit` makes sure the map preview works properly. This is the simplest way to create the preview and is a perfectly reasonable approach in this case, because the code is very simple here.
    41 The final line `onPreviewInit = onGameInit` makes sure the map preview works properly. This is the simplest way to create the preview and is a perfectly reasonable approach in this case, because the code is very simple here.
    42 
    42 
    43 Note: The reason why `onPreviewInit` is provided in the official Lua API is because it allows you to avoid unneccessary overhead in more complex Lua scripts.
    43 Note: The reason why `onPreviewInit` is provided in the official Lua API is because it allows you to avoid unneccessary overhead in more complex Lua scripts.
    44 
    44 
    45 <a href="http://m8y.org/hw/draw2.jpeg">Screenshot here!</a>
       
    46 
       
    47 == Concentric circles and more ==
    45 == Concentric circles and more ==
    48 <code lang="lua">
    46 <code lang="lua">
    49 function onGameInit()
    47 function onGameInit()
    50     MapGen = mgDrawn
    48     MapGen = mgDrawn
    51     TemplateFilter = 0
    49     TemplateFilter = 0
    82 </code>
    80 </code>
    83 The first set of `AddPoint` functions draws a large cross and erases the centre.
    81 The first set of `AddPoint` functions draws a large cross and erases the centre.
    84 The following loop draws a set of nested points, alternating erasure and fill, which results in a set of concentric circles.
    82 The following loop draws a set of nested points, alternating erasure and fill, which results in a set of concentric circles.
    85 The 2nd loop draws a web of lines and frames it using some final `AddPoint` calls.
    83 The 2nd loop draws a web of lines and frames it using some final `AddPoint` calls.
    86 
    84 
    87 <a href="http://m8y.org/hw/draw1.jpeg">Screenshot here!</a>
       
    88 
       
    89 == More examples ==
    85 == More examples ==
    90 Check out the code for these built-in styles:
    86 Check out the code for these built-in styles:
    91 
    87 
    92  * [https://hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Scripts/Multiplayer/DiagonalMaze.lua DiagonalMaze]
    88  * [https://hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Scripts/Multiplayer/DiagonalMaze.lua DiagonalMaze]
    93  * [https://hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua ShoppaMap]
    89  * [https://hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Scripts/Multiplayer/ShoppaMap.lua ShoppaMap]