VS Code & NuGet

The IDE is one way to write sketches. The same sketches also run from VS Code with the DanaProcessing extension, and inside any .NET project with the NuGet packages. A sketch file copied out of the IDE runs as it is in both.

vscodenugetdotnet newtemplatepackageexportSketchApp

On this page · 3 entries

The VS Code extension

Install DanaProcessing from the Extensions view (or the .vsix from the releases), plus the .NET 10 SDK and the C# extension. Then, from the Command Palette (Ctrl+Shift+P), type DanaProcessing:

  • New Sketch creates a project ready to run; Open an Example turns any of the IDE's examples into one, with its NuGet packages.
  • Run Sketch (▶, Ctrl+Alt+R) opens it in its own window. Live (⚡, Ctrl+Alt+L) keeps it running with dotnet watch and applies your edits when you save. Stop is Ctrl+Alt+S. Errors land in the Problems panel.
  • Export as an App makes one file per system (Windows, macOS, Linux) that runs without .NET installed, in export/<platform>/, with the data/ folder.
  • // nuget: NAudio, 2.2.1 lines, as the IDE writes them, become package references when you run. Make This Sketch Runnable creates the project for a .cs saved from the IDE; Open in the DanaProcessing IDE goes the other way.
  • Open the Reference (Ctrl+Alt+H) shows the page of the name under the cursor, and hovering a DanaProcessing name links to it. Snippets: sketch, setup, draw, mousePressed, keyPressed, grid, push, nuget.
The extension speaks English and Spanish: it follows VS Code's display language.

dotnet new dana-sketch

Without VS Code, the template makes the same project from a terminal:

dotnet new install DanaProcessing.Templates
dotnet new dana-sketch -n MySketch
cd MySketch
dotnet run          # or: dotnet watch run, to live-code

The NuGet packages

PackageWhat it is
DanaProcessingThe core: Sketch, 2D and 3D drawing, sound, PVector, PImage, math. No windows: draw off-screen, in tests or on a server.
DanaProcessing.AvaloniaHostThe window: SketchApp.Run() and the AvaloniaSketchCanvas control. Windows, macOS and Linux.
DanaProcessing.TemplatesThe dana-sketch template for dotnet new.

Add a sketch to a program you already have:

dotnet add package DanaProcessing.AvaloniaHost
using DanaProcessing.AvaloniaHost;

SketchApp.Run(new Bubbles());

public class Bubbles : Sketch
{
    public override void Setup() => Size(400, 400);
    public override void Draw()
    {
        Background(20);
        Circle(MouseX, MouseY, 40);
    }
}

Projects with ImplicitUsings get using DanaProcessing; for free, like the IDE (turn it off with <DanaProcessingImplicitUsings>false</DanaProcessingImplicitUsings>). To put a sketch inside your own Avalonia window, see AvaloniaSketchCanvas.