konsumer / deno-minifb

Deno wrapper around minifb, for making a framebuffer you can draw pixels to
11 stars 1 forks source link

rewrite: Move to MiniFB C-API #7

Closed DjDeveloperr closed 2 years ago

DjDeveloperr commented 2 years ago

no longer uses Rust, instead directly uses https://github.com/emoon/minifb

However, there's some downsides...

DjDeveloperr commented 2 years ago

While this new approach is way simpler, I feel like it's a way more limited API. What should we do now? Should we keep using Rust MiniFB (reopen #6 and complete it)? Or just stick to this C-API? cc @konsumer

Btw for WebGPU, I have made deno_desktop (prototype-ish).

konsumer commented 2 years ago

I am not sure. If you have a demo with WebGPU, maybe that would be better? Is this accelerated? I am not stuck on using minifb, more like "use a regular web API to make an accelerated native deno app".

konsumer commented 2 years ago

Oh, wait, I see, it's a fork of deno. Hmm. I am really not sure.

DjDeveloperr commented 2 years ago

deno_desktop project's purpose is quite different from minifb, it's to render things drawn using WebGPU on a window while minifb's to quickly prototype emulators and such. I just mentioned it because I think we do not need to target WebGPU from deno-minifb. But yeah, you could quite easily write a WebGPU-based "minifb" using pure JS as well for deno_desktop, similar to pixels.

What do you think about rust_minifb vs minifb?

konsumer commented 2 years ago

What do you think about rust_minifb vs minifb?

I'm not sure I understand the diff. I originally intended to use the rust lib. I guess I sort of thought it was the same thing, but I don;t have a strong opinion. It seems like it might be easier to use the rust version, but since my actual goal is just "open a window and use a web API to draw in it, in deno" I vote for whatever seems easier.

DjDeveloperr commented 2 years ago

The main downside I'm talking about is MiniFB C is missing some things such as setting title after creating window, resizing it from code, etc. The C-API seems rather limited, while MiniFB Rust has some more features, such as menus.

Being easier depends I think. MiniFB C API might be easier to integrate as you'll not need to write any other language code, but just plug in existing MiniFB library and call methods on it. While MiniFB Rust bindings would need another layer of Rust wrapping the MiniFB Rust API in simple extern C calls, we can tune it to Deno FFI and do optimizations and such. I would honestly prefer C API but the missing features are kinda downside to me. That not being able to set title one is... not what I expected.

DjDeveloperr commented 2 years ago

I'll instead continue work on completing Rust-based FFI bindings, because of these reasons:

Closing this, will re-open the previous PR when I have time to continue on it.

konsumer commented 2 years ago

I will update the README to point to rust minifb.