-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bun support #41
Comments
@Thunderducky I'd like to support bun eventually, but right now their support for napi modules is not even finished (oven-sh/bun#158) and I am encountering too many weird bugs when trying to run the examples. I'd suggest leaving the issue open and I'll revisit it as bun becomes more stable in the future. |
Thank you! Love the library |
I could run a small example with // index.js
import sdl from '@kmamal/sdl'
// Setup
const window = sdl.video.createWindow({ title: "Canvas" })
window.setFullscreen(true);
const { pixelWidth: width, pixelHeight: height } = window
const buffer = Buffer.alloc(width * height * 4).fill(0);
for (let n = 0; n < buffer.length; n += 4) {
const i = Math.floor(n / (4 * width));
const j = Math.floor((n / 4) % width);
const x = j;
const y = height - 1 - i;
buffer[n] = Math.min(255, (x / width) * 255);
buffer[n + 1] = Math.min(255, (y / height) * 255);
buffer[n + 2] = 0;
buffer[n + 3] = 255;
}
console.log("debug ", buffer)
window.render(width, height, width * 4, 'rgba32', buffer); Then ran Great lib btw, thank you @kmamal |
Oh interesting, time to have another look then. |
Just a note here about using One needs to add |
Linking this issue so I can track it easier: oven-sh/bun#9743 |
I tried running the base examples with bun and got segmentation errors when calling
window.render
.I suspect it's related to differences in how the buffer is handled.
If there is a way around this/workaround that'd be great!
The text was updated successfully, but these errors were encountered: