raygui icon indicating copy to clipboard operation
raygui copied to clipboard

Provide `GuiFloatValueBox()`

Open danielchasehooper opened this issue 1 year ago • 5 comments

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

danielchasehooper avatar Oct 02 '23 21:10 danielchasehooper

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.

raysan5 avatar Oct 02 '23 21:10 raysan5

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

benjibst avatar Oct 15 '23 10:10 benjibst

@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.

raysan5 avatar Oct 31 '23 15:10 raysan5

@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 avatar Dec 10 '23 10:12 benjibst

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

benjibst avatar Dec 21 '23 08:12 benjibst

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

raysan5 avatar May 07 '24 08:05 raysan5