You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
Hello.
I think it might be nice to add imgui.Textf which will work similarly to log.Printf and fmt.Errorf found in Go standard library - by doing fmt.Sprintf internally.
This will allow me to replace code like this:
imgui.Text(fmt.Sprintf("some text: %s", str))
with this:
imgui.Textf("some text: %s", str)
... and it will also be kinda similar to how C++'s ImGui::Text works (which allows you to do formatting by "default").
Any thoughts? :)
The text was updated successfully, but these errors were encountered:
This approach would be against the initial API philosophy about the wrapper - and the case for Text() is even listed explicitly as an example for that in the readme. Second, this would add a "new" function which is not available in the original library, and my intent was to keep this library as a thin wrapper as much as possible.
On the other hand, at least for the case of Text(), this decision was about avoiding potential problems with formatting strings and trying to forward any arbitrary references down to C-land; This would be mitigated by your proposal, doing something like
func Textf(format string, a ...interface{}) {
Text(fmt.Sprintf(format, a...))
}
And second, it would be more idiomatic Go, like you wrote - and would be a quality of life feature.
With that reasoning I'm slightly tilting towards your proposal.
Please go ahead, provide a PR, which also rephrases the sample in readme.md - and see if there are any further cases where this applies (e.g. LabelText() & LabelTextf()).
Hello.
I think it might be nice to add
imgui.Textf
which will work similarly tolog.Printf
andfmt.Errorf
found in Go standard library - by doingfmt.Sprintf
internally.This will allow me to replace code like this:
with this:
... and it will also be kinda similar to how C++'s
ImGui::Text
works (which allows you to do formatting by "default").Any thoughts? :)
The text was updated successfully, but these errors were encountered: