drawim

Simple library to draw stuff on a window

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:25

Installation

nimble install drawim
choosenim install drawim
git clone https://github.com/GabrielLasso/drawim

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
drawim - - - - - - -

Source

Repository https://github.com/GabrielLasso/drawim
Homepage https://github.com/GabrielLasso/drawim
Registry Source nimble_official

README

Drawim

A simple drawing library in Nim, inspired by p5js. Builds to native, using OpenGL, and to JavaScript, using HTML5 Canvas.

Usage

A simple example, to draw a rectangle:

import drawim

proc draw() =
  background(0)
  fill(255, 0, 0)
  translate(int(width / 2), int(height / 2))
  rectFill(-100,-100,100,100)

run(600, 400, draw, name = "Drawim example")

To run the example, you can either nim r example.nim or nim js example.nim and include the resulting js in an HTML file containing a div with id="Drawim example".

More examples can be found on examples/ folder.

Installation

Just install with numble by running

nimble install drawim

Features

  • Compiles to native and JS
  • 100% Nim code
  • Basic drawing
  • Read keyboard and mouse input
  • Limit the framerate
  • Rotate, translate and scale
  • Save transform state in a stack (see examples/tree.nim)
  • RGB and HSV colors
  • Bezier curves
  • Easy to extend and create new curves

To do: - Stroke weight - Sprites - Fonts - Unit tests

Documentation

You can find the full docs here