raysan5 / raygui

A simple and easy-to-use immediate-mode gui library
zlib License
3.36k stars 289 forks source link

GuiCheckBox always return 0 (false) #330

Closed Jonathan-Greve closed 12 months ago

Jonathan-Greve commented 12 months ago

As I understand it the function should return 1 (true) when the checked state is changed, so that the calling function can handle the checkbox changed event.

The function in question: https://github.com/raysan5/raygui/blob/25c8c65a6e5f0f4d4b564a0343861898c6f2778b/src/raygui.h#L2193C11-L2193C11

Perhaps just setting result to 1 here would fix it: https://github.com/raysan5/raygui/blob/25c8c65a6e5f0f4d4b564a0343861898c6f2778b/src/raygui.h#L2231C13-L2231C82

raysan5 commented 12 months ago

As I understand it the function should return 1 (true) when the checked state is changed, so that the calling function can handle the checkbox changed event.

You are right! All controls have been redesigned to return internal-states as required but most of those internal-states have not been implemented yet because I was not sure what were the most convenient states to return for every control. Checkbox value change status seems quite useful! Just sent a commit!

Also note that some functions comments could be off at the moment, from previous version.