1 # Tools to extract images from SVG files using Inkscape, either to create icons or game sprites
3 This tool uses Inkscape to prepare assets for Nit applications from a single SVG file.
4 It selects objects to extract from the SVG file when their id begins with `0`.
6 It will produce two files:
8 * A Nit source file that declares a single class with an attribute for each selected object.
9 The attribute usually holds a single texture, except if the the id ends with a digit, then it will be an array.
11 * A single PNG image file that contains all the selected objects.
12 With the option `--pow2`, the image size is rounded to the next of 2.
16 1. Create a new Inkscape document.
17 2. Create objects and set their ids to begin with `0`.
18 3. Save the document to `drawing.svg` (for this example), the name of the file is used to name the Nit class.
19 4. Execute `bin/svg_to_png_and_nit drawing.svg`
20 5. From your code, import the generated source file at `src/drawing.nit`.
21 6. Use the class `DrawingImages` and its attributes.
25 The minimal test in `tests/app/` shows the basic usage of this tool.
27 The Dino example `../../../../examples/mnit_dino` also uses this tool and is a more complete and practical example.