greenfork / nimraylib_now

The Ultimate Raylib gaming library wrapper for Nim
MIT License
151 stars 17 forks source link

Glyphs & recs as UncheckedArray ptr #64

Closed ryback08 closed 2 years ago

ryback08 commented 2 years ago

Hello

I translate : https://www.raylib.com/examples/text/loader.html?name=text_rectangle_bounds

I have modify Font object with Unchecked Array ptr for "recs" and "glyphs". I don't know if it is the good solution.

planetis-m commented 2 years ago

The files are autogenerated by src/convert_c_to_nim.nim Instead you can use the https://github.com/nim-lang/c2nim/blob/master/doc/c2nim.rst#id21 directive to instruct c2nim to produce arrays.

planetis-m commented 2 years ago

Actually isarray applies only on proc parameters and not fields, which is a same. A better solution is using c2nim#araq-gobject with support for a custom post processor.

greenfork commented 2 years ago

@ryback08 example looks great! A comment about beginDrawing - I think we would prefer using its block form, similar comment to your other PR, looks like a more Nim-way. Would you mind changing it?

About UncheckedArray change, as @planetis-m said, the bindings are auto-generated, so you would want to modify the https://github.com/greenfork/nimraylib_now/blob/bc021ec423a858b0ce7b9ba44ae94c028aaa6332/src/convert_c_to_nim.nim#L396-L436 lines. If this seems too much, could you please then just remove these changes and I can do them in master branch myself?

greenfork commented 2 years ago

@planetis-m it's a good thing about #isarray directive, I didn't notice it before. Maybe we can integrate it as well after we decide how to move forward with JSON thing

greenfork commented 2 years ago

Great, thanks! I added tests as well. I merged it through git interface, see commits here https://github.com/greenfork/nimraylib_now/commits/master. I'm not yet sure how to modify pull requests properly