jaylib icon indicating copy to clipboard operation
jaylib copied to clipboard

better arrays

Open electronstudio opened this issue 5 years ago • 1 comments

Javacpp accesses C arrays via pointers, e.g. model.materials().position(1).maps().position(2)

This is weird for a Java programmer because it isn't just an accessor; it modifies the position field of the object, and is obviously highly unsafe. It would be better if we could convert the C arrays into Java arrays, or at least wrap a List interface around them.

electronstudio avatar Apr 03 '20 09:04 electronstudio

We could perhaps make a class like ArrayWrapper<T>(Pointer p, int size) with methods such as get(index) and set(index) which will handle the requests carefully using the C style pointers, but the user would not need to be aware of it.

MerujSargsyan avatar Oct 01 '24 15:10 MerujSargsyan