Open xEricL opened 5 days ago
hi, GetScaleFactor was a part of imgui-go api. Now, we check scale as follows: (MasterWindow.go)
// Scale DPI in windows
if runtime.GOOS == "windows" {
xScale, _ := Context.backend.ContentScale()
imgui.CurrentStyle().ScaleAllSizes(xScale)
}
go get access to Context.backend try using cimgui.CurrentBackend
What happend?
In v0.7, I used
Context.GetPlatform().GetContentScale()
to scale a progress bar. However, it appearsGetPlatform()
has been removed in v0.8.0 in this commit.What is the alternative?
Code example
I was using ```golang giu.SingleWindow().Layout( giu.Align(giu.AlignCenter).To( giu.Dummy(0, scaleDivider(6)), giu.ImageWithRgba(logoI).Size(LogoSize, LogoSize), giu.Dummy(0, scaleDivider(6)), giu.ProgressBar(ReadProgress()).Size(scaleValue(WindowWidth)*0.75, scaleValue(5)), ), ) ``` where `scaleDivider` and `scaleValue` were defined as ```golang func scaleDivider(value float32) float32 { scale := giu.Context.GetPlatform().GetContentScale() if scale > 1.0 { value *= 2 } return value * scale } func scaleValue(value int) float32 { scale := giu.Context.GetPlatform().GetContentScale() return float32(value) * scale } ```main.go
To Reproduce
giu.Context.GetPlatform().GetContentScale()
Version
(latest)
OS
Fedora