raysan5 / raygui

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

Add floating point value box to raygui #356

Closed benjibst closed 4 months ago

raysan5 commented 8 months ago

@benjibst this is a breaking change for raygui because it requires a new function from raylib, not merging it for now but I keep the PR open while thinking what should be done with it...

benjibst commented 8 months ago

@raysan5 ah ok, got it, maybe one solution could be to just use the c standard library?

raysan5 commented 8 months ago

maybe one solution could be to just use the c standard library?

Yeap, probably that's the best solution at this point.

raysan5 commented 4 months ago

@benjibst What is the state of this PR? Is it possible to move val_str to a static variable inside the control? It can be updated on editMode and just reseted on exiting editMode. Afaik, in most use cases there won't be two floats being edited at the same time.

benjibst commented 4 months ago

@raysan5 last time i tried to implement this with a static text buffer, but the problem is that when you edit the value of one textbox, and then switch to the other textbox, the float value in the text buffer is shared so the value of the second textbox gets overwritten

raysan5 commented 4 months ago

@benjibst I see the issue now. It happens when switching from one text box to another directly without exiting the first one "properly" so it's like two text boxes are active for one frame... mmmh... thinking if it can be addressed in some way...

raysan5 commented 4 months ago

@benjibst I'm merging this PR and I'll try to find some solution in the meantime... Thanks again for all the work you put on this improvement! :)

benjibst commented 4 months ago

ah, do you mean like: if you exit from one valuebox properly, it can parse the string and then clear the buffer? so that the next valuebox knows its allowed to overwrite the static buffer with its own float?


From: Ray @.> Sent: Tuesday, May 7, 2024 12:05:33 PM To: raysan5/raygui @.> Cc: Benjamin Schmid Ties @.>; Mention @.> Subject: Re: [raysan5/raygui] Add floating point value box to raygui (PR #356)

@benjibsthttps://github.com/benjibst I see the issue now. It happens when switching from one text box to another directly without exiting the first one "properly" so it's like two text boxes are active for one frame... mmmh... thinking if it can be addressed in some way...

— Reply to this email directly, view it on GitHubhttps://github.com/raysan5/raygui/pull/356#issuecomment-2097929562, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ASELDNQD7FYQZKJKNDPLTO3ZBCRO3AVCNFSM6AAAAABAPWXI76VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJXHEZDSNJWGI. You are receiving this because you were mentioned.Message ID: @.***>

raysan5 commented 4 months ago

@benjibst Yes, that's my idea but I'm not sure if it would work... As per my understanding, at the moment it fails because when you "jump" from one GuiValueBox to another, the state logic for editMode keeps executing without an exit logic... but I could be wrong... it needs to be tested...