Minimal graphical applications in BQN
fenster@e700581dfb | ||
.gitignore | ||
.gitmodules | ||
example.bqn | ||
example.png | ||
fenster.bqn | ||
lib.c | ||
LICENSE | ||
Makefile | ||
README.org |
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 widthw
and heighth
, with titlet
. Returns a window handle.CloseWindow w
closes a window given its handlew
.F _render w
runs the functionF
at each coordinate of the windoww
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 elementsx‿y‿t
, wherex
andy
are the pixel coordinates andt
is the time.
Example
See example.bqn.
f←•Import "fenster.bqn"
size←500
w←f.OpenWindow size‿size‿"bqn-fenster example"
Rainbow←{𝕊x‿y‿t:
x‿y↩x‿y÷size
t↩(100|t)÷100
h←(x+y)÷2
f.HSVtoRGB⟨360×h,1,1⟩
}
Rainbow f._render w
•Delay 3
f.CloseWindow w