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

Potentially wrong type exports

Open Triazic opened this issue 1 year ago • 5 comments

image

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

As provided in your type definitions: image

Triazic avatar Jun 29 '23 10:06 Triazic

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

konsumer avatar Jun 29 '23 17:06 konsumer

There is no SetShaderValue function exposed.

image

Using this version: image

Triazic avatar Jul 01 '23 11:07 Triazic

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.

konsumer avatar Jul 01 '23 20:07 konsumer

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

Triazic avatar Jul 02 '23 01:07 Triazic

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

twuky avatar Jul 02 '23 04:07 twuky