Skip to content
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

The road to 1.0 #101

Open
1 of 5 tasks
emoon opened this issue Nov 11, 2019 · 10 comments
Open
1 of 5 tasks

The road to 1.0 #101

emoon opened this issue Nov 11, 2019 · 10 comments
Assignees

Comments

@emoon
Copy link
Owner

emoon commented Nov 11, 2019

This crate has now been around for almost 4 years (Nov 22, 2015) so I guess it's time to start moving it towards 1.0 but before that there is some issues I want to be done before.

  • More things. Proper scaling without hick-ups for dynamic sized windows.
  • Should it be possible to specific RGB(0) ordering of the buffers?
  • Should software support be deprecated (Linux only pretty much)
  • Also a clean-up of all the remaining issues. I would like to have zero issues (if possible) when hitting 1.0
  • More examples of all features.
  • Add multi-threaded example
  • Add frame-rate limiting example

More suggestions can be added in the comments. I will start adding issues I want to fix for the https://github.com/emoon/rust_minifb/milestone/1 milestone

@emoon emoon self-assigned this Nov 11, 2019
@tversteeg
Copy link
Contributor

Maybe software support could be a feature?

@sinclairzx81
Copy link
Contributor

sinclairzx81 commented Nov 12, 2019

@emoon Thanks for all your hard work on minifb, love this crate! Looking forward to the 1.0 release! :D

Should it be possible to specific RGB(0) ordering of the buffers?

This would be a cool feature. I think currently, the buffers in minifb may linearly line up as BGRA (as little endian u32 arrays). Seeing as WASM is listed as an upcoming, it could be worth making note of the browsers ImageData using RGBA ordering as a pretty good rationale for including ordering as a feature.

ImageData.data Read only

Is a Uint8ClampedArray representing a one-dimensional array containing the data in the RGBA order, with integer values between 0 and 255 (inclusive).

I wonder if having the option to define the order as well as being able to submit buffers as Vec<u8> might be possible. This may make it easier to transfer ImageData buffers between the Page and WASM context's without the need to remap the buffer prior to update_with_buffer(...). With the Vec<u8> option added to help avoid the need to transmute between u8 and u32 buffers when setting RGBA values in the buffer. Also, Vec<u8> buffers makes the order super explicit when setting RGB values.

One common use case I expect would be to have the page load images (as RGBA) which are then passed to minifb to present (currently BGRA).

@tversteeg @FloVanGH Thoughts?

// possible Uint8ClampedArray passed from the page.
let mut buffer: Vec<u8> = vec![0; WIDTH * HEIGHT * 4];

let mut window = Window::new(
      "rgba ordering",
      WIDTH,
      HEIGHT,
      WindowOptions {
       order: Order::RGBA,
      ..WindowOptions::default()
    },
);
...
window.update_with_u8_buffer(&buffer).unwrap();

Again, thanks for all the work put into minifb!

@nicolasbauw
Copy link

I'm thinking about:

  • 32-bit buffer as RGBA instead of 0RGB
  • so, the buffer should adequately handle transparency to allow alpha compositing
  • Option for the buffer swap to wait VBL for smoother animations (and avoid if we want to wait by counting time)
  • accelerated blitting / clear area / clear whole buffer / texture generation / textured surfaces / scaling / rotation and so on functions

@emoon
Copy link
Owner Author

emoon commented Jan 23, 2020

I think first 3 points are doable but I think that point 4 is out of scope for minifb.

@nyovaya
Copy link
Contributor

nyovaya commented Jun 18, 2020

@emoon What do you think about an event loop for 1.0?

@emoon
Copy link
Owner Author

emoon commented Jun 18, 2020

Exactly how would that look like? I feel that the current design is simple and nice to use and I wouldn't like to break it if possible.

@nyovaya
Copy link
Contributor

nyovaya commented Jun 18, 2020

Similar to how SDL and GLFW do this.

@emoon
Copy link
Owner Author

emoon commented Jun 18, 2020

GLFW uses callbacks and such for key presses and such. In general I want to avoid callbacks because it makes things more complicated. What are the biggest motivations for this change?

@nyovaya
Copy link
Contributor

nyovaya commented Jun 18, 2020

Im not talking about callbacks. GLFW uses an event loop: https://docs.rs/glfw/0.38.0/glfw/fn.flush_messages.html
We dont need to save all changes in specific structs so we basically dont even process them but rather save the events the server sent and allow the developer to process them like they please to.

@emoon
Copy link
Owner Author

emoon commented Jun 18, 2020

Alright. Yeah, that might be a good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants