raylib-go icon indicating copy to clipboard operation
raylib-go copied to clipboard

Places where slices are expected are pointers to underlying value instead (Model, Font)

Open SolarLune opened this issue 4 years ago • 3 comments
trafficstars

Hello, sorry for the confusing / generic title.

It seems like in a few places where, say, the C sources expect a pointer to the start of an array of elements, it's the exact same in Go. It feels like it should be expecting a pointer to a slice of the underlying elements instead.

For example:

  • rl.LoadFontEx() still takes a pointer to an int32 for the font characters to load, when it should presumably be a slice of runes.
  • rl.Model.Materials is a pointer to a singular rl.Material, when it probably should be a slice of the Materials in use on the Model. Same for rl.Model.Meshes, rl.Model.Bones, and rl.Model.Materials.Maps.

SolarLune avatar Jun 02 '21 15:06 SolarLune

rl.Model.Materials I am not touching that again, it is what it is, it caused a lot of problems before. LoadFontEx can be modified, PR is welcomed.

gen2brain avatar Jun 02 '21 15:06 gen2brain

Pointer to rl.Material in C is array btw.

gen2brain avatar Jun 02 '21 15:06 gen2brain

Examples now use the new function SetMaterialTexture, similar functions are needed in order for this to work, or user can use unsafe/C to set this. Not easy, but can be done.

gen2brain avatar Jun 08 '21 11:06 gen2brain