snuk182 / nuklear-rust

The bindings to the Nuklear 2D immediate GUI library.
Apache License 2.0
359 stars 16 forks source link

i8 u8 tomato tomato? #34

Open pietervandermeer opened 3 years ago

pietervandermeer commented 3 years ago

Got this puppy running on my old Macbook and it works like a charm! Muchas gracias! But moving over to Raspberry Pi4, there seems to be many i8 u8 type problems. The nk_ functions seem to want u8, but get i8..

error[E0308]: mismatched types
    --> /root/.cargo/registry/src/github.com-1285ae84e5963aae/nuklear-rust-0.6.3/src/lib.rs:3352:50
     |
3352 |             nk_textedit_text(&mut self.internal, arg2.as_ptr() as *const i8, arg2.as_bytes().len() as ::std::os::raw::c_int);
     |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`

error[E0308]: mismatched types
    --> /root/.cargo/registry/src/github.com-1285ae84e5963aae/nuklear-rust-0.6.3/src/lib.rs:3379:56
     |
3379 |         unsafe { nk_textedit_paste(&mut self.internal, arg2.as_ptr() as *const i8, arg2.as_bytes().len() as ::std::os::raw::c_int) != 0 }
     |                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
     |
     = note: expected raw pointer `*const u8`
                found raw pointer `*const i8`

Is this easily fixed?

My Cargo.toml has the following deps:

nuklear-rust = {version = "~0.6"}
nuklear-backend-gfx = "~0.9"
gfx_device_gl = "~0.16"
gfx_window_glutin = "~0.30"
gfx = "~0.18"
glutin = "~0.20"
image = "~0.12"
snuk182 commented 3 years ago

Hi, thanks for the input!

Meh... unfortunately I cannot say a meaningful thing regarding an easy fix for the type mismatch problem. Perhaps forking the project with changing the necessary type at that method passes as a workaround. Also I'm ATM buried with my main work, so cannot pay much attention to the project, but pull requests are always welcome!