Choose a tutorial:
Draw XXL offers a feature called "code snippets" which can speed up your workflow.
This feature is only available if you use Visual Studio as your IDE on Windows. Otherwise you can skip this chapter.
There is an extra installation step required (beside importing the Draw XXL package into your Unity project) in order to be able to use the code snippets. This installation step is described later.
So how do the code snippets work? They simplify the creation of code by inserting whole code blocks through typing in only a short key combination.
If we take the vector drawing example from the previous section ("Drawing with code") we don't have to look up the correct function name nor all the optional parameters.
Instead the key combination "d-v-f-tab-tab" will insert this code block:
It may seem much at first, but is not doing anything else than in the example from the "Drawing with code" chapter: Drawing a vector.
We only have to care for filling values to the first two lines - these are the two required parameters of the vector drawing function.
All other lines are the optional parameters and they are already assigned with their default value. You can ignore them, or change their value without the hazzle of looking them up in the documentation and keeping the right order.
And how do we get the required key combination? Every draw function in Draw XXL has a code snippet name that is noted on the functions API description page.
For example the "DrawBasics.VectorFrom()" has "drawVectorFrom" as code snippet name:
The trick is: You don't have to know the exact code snippet name or look it up. It's enough to only supply some characters of the whole code snippet word and Visual Studio will offer a list of auto-completion options.
So in the above example it was enough to type in only the leading characters of every word: "drawVectorFrom".
Typing "dvf" leads to Visual Studio offering the following auto-completion list:
Then typing "tab" twice is just selecting and inserting the chosen code snippet.
Note that all of Draw XXL code snippet names start with the word "draw". So the first letter of your code snippet abbreviation should always be a "d".
The following letters are mostly common sense by thinking of what you want to draw. Do you want to draw a triangle shape? Then try "d-tri" and see what Visual Studio offers you:
It displays four options for "drawTriangle". This is because a triangle can be constructed in differnt ways. Draw XXL offers two different functions for drawing a triangle: One takes the rotation as quaternion, and the other takes the rotation as normal vector.
You can choose in the auto-completion list which one you prefer.
Moreover you see in the auto-completion list snippet names that end with "_func".
This is because every Draw XXL function has two snippets. One that just inserts the function and the parameter list into the code, and the other one creates a new function inside your code that encapsulates the draw operation with all its parameters.
The "_func" version of the above used "VectorFrom()" snippet would look like this:
As mentioned there is an extra installation step required to be able to use the code snippets: