RobLoach / node-raylib

Node.js bindings for Raylib
https://robloach.github.io/node-raylib/
Other
245 stars 20 forks source link

Potentially wrong type exports #175

Open Triazic opened 1 year ago

Triazic commented 1 year ago

image

Calling SetShaderVector4 gives a runtime error: SetShaderVector4 is not a function. The correct function is SetShaderVec4.

As provided in your type definitions: image

konsumer commented 1 year ago

Hmm, neither SetShaderVector4 or SetShaderVec4 are listed on cheatsheet, so the wrapping/typescript-generation code may be out-of-date that includes it, but it's not part of raylib 4.5. I think it has moved to SetShaderValue see this example that used to have SetShaderVec4

Triazic commented 1 year ago

There is no SetShaderValue function exposed.

image

Using this version: image

konsumer commented 1 year ago

I saw your other solution on #174 where you use SetShaderVec4. Did you get it worked out? I think there may be a mismatch on the typescript generation and raylib version. @twuky does the typescript stuff, since @RobLoach and I mostly don't use it. The API we should shoot for is current 4.5 I think, which uses SetShaderValue.

Triazic commented 1 year ago

SetShaderVec4 works yes, but I need to override typescript (//@ts-ignore). The type export isn't there.

twuky commented 1 year ago

SetShaderValue isn't supported because it's not as simple to handle in our C implementation (its a void pointer, but you provide an extra argument to detail what value is supposed to be at that pointer). so instead I implemented statically typed functions that handle individual types. but somewhere along the way wires got crossed and they are named improperly across the typescript defs and the actual JS functions - put together a branch that fixes that