irishgreencitrus / raylib.v

A simple wrapper for raylib in V
zlib License
61 stars 13 forks source link

Use V strings for function args/return types #21

Open squidink7 opened 9 months ago

squidink7 commented 9 months ago

This PR changes the functions exposed by the library to take/return V strings rather than pointers to C strings. This means you don't need to use 'V string here'.str whenever you call a raylib function, and you don't need to convert back to a V string whenever you get a string result from raylib.

I also commented out some API functions to build with the newer raylib versions, which is unrelated to this PR and might cause issues, so I wouldn't recommend merging until I get that sorted out.

irishgreencitrus commented 9 months ago

Thanks for this, its something I've had on my todo list for a while. However I will need to put the merge on hold until I get raylib.v working with the latest raylib and V version.

squidink7 commented 9 months ago

Of course! It already seems to work fine with the latest V, but does need some changes for Raylib 4.5 as you say. I was also thinking of moving some functions into methods of various structs (e.g. image_resize(img Image, ...) becomes img.resize() where img is an instance of Image) or even using V's new static methods for grouping certain functions (e.g. Image.load(...)) but wanted to get your input first as that's a bit more of a drastic change.