diff --git a/FontAtlasProsessor.go b/FontAtlasProsessor.go index eaff5470..524e964b 100644 --- a/FontAtlasProsessor.go +++ b/FontAtlasProsessor.go @@ -175,6 +175,14 @@ func tStrPtr(str *string) *string { return str } +func tStrSlice(str []string) []string { + for _, s := range str { + tStr(s) + } + + return str +} + // Rebuild font atlas when necessary. func rebuildFontAtlas() { if !shouldRebuildFontAtlas { diff --git a/Plot.go b/Plot.go index d992e382..e1538837 100644 --- a/Plot.go +++ b/Plot.go @@ -347,10 +347,7 @@ func (p *PlotPieChartWidget) Angle0(a float64) *PlotPieChartWidget { } func (p *PlotPieChartWidget) Plot() { - for _, l := range p.labels { - tStr(l) - } - imgui.ImPlotPieChart(p.labels, p.values, p.x, p.y, p.radius, p.normalize, p.labelFormat, p.angle0) + imgui.ImPlotPieChart(tStrSlice(p.labels), p.values, p.x, p.y, p.radius, p.normalize, p.labelFormat, p.angle0) } type PlotScatterWidget struct { diff --git a/Widgets.go b/Widgets.go index 3ab8191e..ce0239fa 100644 --- a/Widgets.go +++ b/Widgets.go @@ -569,14 +569,10 @@ type ComboWidget struct { } func Combo(label, previewValue string, items []string, selected *int32) *ComboWidget { - for _, item := range items { - tStr(item) - } - return &ComboWidget{ label: tStr(label), previewValue: tStr(previewValue), - items: items, + items: tStrSlice(items), selected: selected, flags: 0, width: 0,