Minimal graphical applications in BQN
| fenster@e700581dfb | ||
| .gitignore | ||
| .gitmodules | ||
| example.bqn | ||
| example.png | ||
| fenster.bqn | ||
| lib.c | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
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
High-level API:
F _display width‿heightcreates a window of the given dimensions and displays its left operand.Fshould be a function returning a color as an RGB triplet in the (0,1) range, and taking a list of two elementsx‿y, wherexandyare the pixel coordinates.
Low-level API:
OpenWindow w‿h‿topens a window of widthwand heighth, with titlet. Returns a window handle.CloseWindow wcloses a window given its handlew.F _render wruns the functionFat each coordinate of the windowwand set the corresponding pixel color.Fis a function with the same arguments as for_display.
Example
See example.bqn.
f←•Import"fenster.bqn"
size←500
Rainbow←{𝕊x‿y:
x‿y↩x‿y÷size
h←(x+y)÷2
f.HSVtoRGB⟨360×h,1,1⟩
}
Rainbow f._display size‿size
