mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
parent
ba674a686c
commit
fea802b39d
@ -24,6 +24,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/v2/internal/devicescale"
|
"github.com/hajimehoshi/ebiten/v2/internal/devicescale"
|
||||||
@ -43,7 +44,7 @@ type UserInterface struct {
|
|||||||
windowWidth int
|
windowWidth int
|
||||||
windowHeight int
|
windowHeight int
|
||||||
|
|
||||||
running bool
|
running uint32
|
||||||
toChangeSize bool
|
toChangeSize bool
|
||||||
origPosX int
|
origPosX int
|
||||||
origPosY int
|
origPosY int
|
||||||
@ -198,16 +199,15 @@ func getCachedMonitor(wx, wy int) *cachedMonitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) isRunning() bool {
|
func (u *UserInterface) isRunning() bool {
|
||||||
u.m.RLock()
|
return atomic.LoadUint32(&u.running) != 0
|
||||||
v := u.running
|
|
||||||
u.m.RUnlock()
|
|
||||||
return v
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) setRunning(running bool) {
|
func (u *UserInterface) setRunning(running bool) {
|
||||||
u.m.Lock()
|
if running {
|
||||||
u.running = running
|
atomic.StoreUint32(&u.running, 1)
|
||||||
u.m.Unlock()
|
} else {
|
||||||
|
atomic.StoreUint32(&u.running, 0)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserInterface) getInitTitle() string {
|
func (u *UserInterface) getInitTitle() string {
|
||||||
|
Loading…
Reference in New Issue
Block a user