raysan5 / raygui

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

Provide `GuiFloatValueBox()` #343

Closed danielchasehooper closed 4 months ago

danielchasehooper commented 11 months ago

Sometimes people need to be able to view and edit float values

raysan5 commented 11 months ago

Yeah, I agree but that's actually a quite complex function, the "dot" possition depends on the locale of the system and could be difficult to manage properly.

benjibst commented 10 months ago

I tried to make this today because i needed it myself, but i got stuck because when editing the float value's decimal places (pressing backspace), on the next function call they are printed out again. I think this needs some external text memory where you first edit the text and then update the value. @raysan5 pls let me know what you think, im trying to help but idk if this is the right approach

raysan5 commented 10 months ago

@benjibst Afaik, approach should be similar to GuiValueBox() but parsing the value as a float (instead of int) and probably limiting it to 3 decimal positions.

benjibst commented 9 months ago

@danielchasehooper I made this now, on my profile you can find a fork to raylib and raygui if you still need it. the usage is a bit different, you have to provide a data buffer when you call the function where it stores the string representation of the float.

benjibst commented 8 months ago

@raysan5 i made a pull request for this, would you mind taking a look?

raysan5 commented 4 months ago

Related PR https://github.com/raysan5/raygui/pull/356. We can continue the discussion in there.