Skip to content

Conversation

@thetrung
Copy link

As I try raylib/ocaml, I see it lack the name property expose for ModelAnimation - which currently is a char [32].

@thetrung thetrung force-pushed the main branch 3 times, most recently from 890d30e to 0e59563 Compare October 14, 2025 07:42
@tjammer
Copy link
Owner

tjammer commented Oct 14, 2025

Thanks for the improvement, I didn't realize this was missing!
I'm wondering if there is a way to coerce this char array into a string so the signature can read

val name : t -> string (* Instead of char CArray.t *)

@thetrung
Copy link
Author

thetrung commented Oct 16, 2025

Yeah, It would be much more convenient to expose t -> string for animation name.
But the way I see it, raylib c library intentionally use char [32] array.
So if we want string, we can convert it on the expose function like this :

let carray_char_to_string (char_arr: char Ctypes_static.carray) : string =
  let ptr = Ctypes.CArray.start char_arr in 
  Ctypes.string_from_ptr ptr ~length:32

Which I just tested & re-commit.
Just what bugged me is, this wasn't directly just value, but at some cost to convert.

@thetrung thetrung force-pushed the main branch 3 times, most recently from 1ba5737 to d9e5f9e Compare October 16, 2025 04:31
- fixed asset path in example/model_animation.ml.
@tjammer tjammer merged commit e89dc94 into tjammer:main Oct 16, 2025
6 checks passed
@tjammer
Copy link
Owner

tjammer commented Oct 16, 2025

Looks good, thank you

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

Successfully merging this pull request may close these issues.

2 participants