mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
devicescale: Refactoring
This commit is contained in:
parent
ea284d86fd
commit
836e320b6b
@ -46,21 +46,21 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
go scaleUpdater()
|
||||
}
|
||||
|
||||
func impl(x, y int) float64 {
|
||||
return math.Float64frombits(atomic.LoadUint64(&cachedScale))
|
||||
}
|
||||
|
||||
// run as goroutine. Will keep the desktop scale up to date.
|
||||
// Run as goroutine. Will keep the desktop scale up to date.
|
||||
// This can be removed once the scale change event is implemented in GLFW 3.3
|
||||
func scaleUpdater() {
|
||||
//
|
||||
// TODO: Now the value is cached, isn't this loop needed?
|
||||
go func() {
|
||||
for {
|
||||
s := getscale(0, 0)
|
||||
atomic.StoreUint64(&cachedScale, math.Float64bits(s))
|
||||
time.Sleep(cacheUpdateWait)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func impl(x, y int) float64 {
|
||||
return math.Float64frombits(atomic.LoadUint64(&cachedScale))
|
||||
}
|
||||
|
||||
func currentDesktop() desktop {
|
||||
|
Loading…
Reference in New Issue
Block a user