| Crates.io | fluffl |
| lib.rs | fluffl |
| version | 0.0.5 |
| created_at | 2020-11-06 10:20:26.617754+00 |
| updated_at | 2022-10-21 11:44:50.928905+00 |
| description | A cross-platform multimedia layer that exposes opengl,sockets,and audio utilities for desktop and browser |
| homepage | |
| repository | https://github.com/K-C-DaCosta/fluffl |
| max_upload_size | |
| id | 309186 |
| size | 841,388 |
fluffl is a media layer that provides an extremely simple, but cross-platform, interface between desktop and wasm targets. Its built on top of the glow OpenGL bindings.
If you need a simple layer/interface that provides audio,graphics, and maybe networking then this is the crate for you.
Interface-wise its like SDL(you can use literally use* SDL if you select it) but it doesn't depend on the wasm32-unknown-emscripten target. The emscripten target is considered to be deprecated and is intended on being phased out last I checked. Instead, this crate uses the preferred wasm32-unkown-unknown target when building for the browser.
WEBGL and WEBAUDIOSDL2 is selected for windowing
SDL2 but with AUDIO_SUBSYTEM enabledGLUTIN is slected for windowing
ALSA - on linuxWASAPI - on windowsFor desktop targets GLUTIN (for windowing) and native audio APIS are chosen by default since it doesn't require the program to link to SDL2 dynamic libraries since SDL2 may not be installed on a lot of machines we can avoid a link error on compile. GLUTIN also appears to use either use native libraries or directly interacts with operating-system specific windowing protocols (major protocols are X windowing protocol and Wayland on linux)
If you STILL want to use SDL2 make sure its actually Installed
Just use apt to install:
sudo apt install libsdl2-dev
Its slightly more complicated. IIRC, you have to either drag the sdl2.dll (you either download it off the offical website or compile it yourself) file to a special directory where the compiler sits or place it in the directory where the binary is. My directions are currently vague because my main OS is linux and I'd have to reconfig my KVM instance of windows to figure out exactly what to do again. Luckily you can just cross-compile.
Using MinGW you can actually build for windows on linux.
On ubuntu first install mingw :
sudo apt install mingw-w64
Then use rustup to install the mingw toolchain
rustup target add x86_64-pc-windows-gnu
Finally to compile you program do:
cargo build --target=x86_64-pc-windows-gnu
The beauty of cross compilation is you can immediatly test the windows binary on your linux machine by running binary in WINE and it just werks (TM) .
Wine chads... I kneel
Check the examples folder for runnable demos.
Wasm version of the examples are here: https://k-c-dacosta.github.io/wasm_bins/examples/audio_ex_1/
https://k-c-dacosta.github.io/wasm_bins/examples/brick_demo/
./fluffl/examplescargo run --exmaple=brick_demo
This crate has over 20k lines. I have a hand-coded GUI ,AudioMixer, linear-algebra and fixed-pont libs built into the library that I'm considering splitting off into other crates.