raylibtech / rtools

rtools feedback and issues
17 stars 1 forks source link

[rGuiLayout] Generated C code outputs compilation errors when using GuiScrollPanels #10

Closed wion531 closed 2 years ago

wion531 commented 3 years ago

When I add GuiScrollPanels to my layout and attempt to compile the generated C code, it outputs two errors on the line that calls the GuiScrollPanel function: error C2440: 'function': cannot convert from 'Vector2' to 'Vector2 *' error C2440: '=': cannot convert from 'Rectangle' to 'Vector2'

Here's the line of code that causes the error: ScrollPanel007ScrollOffset = GuiScrollPanel((Rectangle){ 0, 70, 345 - ScrollPanel007BoundsOffset.x, 925 - ScrollPanel007BoundsOffset.y }, (Rectangle){ 0, 70, 345, 925 }, &ScrollPanel007ScrollOffset);

ScrollPanel007ScrollOffset is defined as a Vector2, GuiScrollPanel returns a Rectangle, so that's clearly the cause of the first error. The second error is given because the third parameter for GuiScrollPanel is a pointer to a Vector2, but ScrollPanel007ScrollOffset is only a Vector2.

I'm using MSVC 2019 from the command line to compile, rGuiLayout v2.1 ONE, raygui v2.6, and raylib 3.5.

raysan5 commented 3 years ago

@wion531 Oh, thanks for letting me know! I'll review that part of code generation.

raysan5 commented 2 years ago

Reviewed.