Minimal graphical applications in BQN
Find a file
2024-09-20 22:42:10 +02:00
fenster@e700581dfb Initial commit 2024-09-20 22:19:17 +02:00
.gitignore Initial commit 2024-09-20 22:19:17 +02:00
.gitmodules Initial commit 2024-09-20 22:19:17 +02:00
example.bqn Initial commit 2024-09-20 22:19:17 +02:00
example.png Add a readme and license 2024-09-20 22:42:10 +02:00
fenster.bqn Initial commit 2024-09-20 22:19:17 +02:00
lib.c Initial commit 2024-09-20 22:19:17 +02:00
LICENSE Add a readme and license 2024-09-20 22:42:10 +02:00
Makefile Initial commit 2024-09-20 22:19:17 +02:00
README.org Add a readme and license 2024-09-20 22:42:10 +02:00

Minimal graphical applications in BQN

Bindings for Fenster, providing a set of functions for displaying a window and setting the color of individual pixels inside.

Setup

Clone the repository recursively (git clone --recurse-submodules) and run make to build the shared library. The Makefile should work on Linux and macOS.

API

  • OpenWindow w‿h‿t opens a window of width w and height h, with title t. Returns a window handle.
  • CloseWindow w closes a window given its handle w.
  • F _render w runs the function F at each coordinate of the window w and set the corresponding pixel color. F should be a function returning a color as an RGB triplet in the (0,1) range, and taking a list of three elements x‿y‿t, where x and y are the pixel coordinates and t is the time.

Example

See example.bqn.

f•Import "fenster.bqn"

size500

wf.OpenWindow sizesize"bqn-fenster example"

Rainbow{𝕊xyt:
  xyxy÷size
  t(100|t)÷100
  h(x+y)÷2
  f.HSVtoRGB360×h,1,1
}

Rainbow f._render w

•Delay 3

f.CloseWindow w

/dimitri/bqn-fenster/media/commit/3021529d92880a349030dde8ae1d63796377ff4b/example.png