Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dlozeve/bqn-fenster
Minimal graphical applications in BQN
https://github.com/dlozeve/bqn-fenster
bqn fenster gui
Last synced: about 1 month ago
JSON representation
Minimal graphical applications in BQN
- Host: GitHub
- URL: https://github.com/dlozeve/bqn-fenster
- Owner: dlozeve
- License: bsd-3-clause
- Created: 2024-09-20T20:20:25.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-11-11T21:30:14.000Z (about 1 month ago)
- Last Synced: 2024-11-11T22:27:42.578Z (about 1 month ago)
- Topics: bqn, fenster, gui
- Language: BQN
- Homepage:
- Size: 1.42 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Minimal graphical applications in BQN
Bindings for [Fenster](https://github.com/zserge/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‿height` creates a window of the given dimensions
and displays its left operand. `F` should be a function returning a
color as an RGB triplet in the (0,1) range, and taking a list of two
elements `x‿y`, where `x` and `y` are the pixel coordinates.Low-level 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` is a function with
the same arguments as for `_display`.## Example
See [example.bqn](./example.bqn).
```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
```![img](./example.png)