mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
ui: Keep the device scale to avoid re-calculation
This commit is contained in:
parent
d6219e38d8
commit
93cdfe107e
@ -34,6 +34,7 @@ type userInterface struct {
|
||||
width int
|
||||
height int
|
||||
scale float64
|
||||
deviceScale float64
|
||||
funcs chan func()
|
||||
running bool
|
||||
sizeChanged bool
|
||||
@ -208,7 +209,10 @@ func (u *userInterface) glfwSize() (int, int) {
|
||||
}
|
||||
|
||||
func (u *userInterface) actualScreenScale() float64 {
|
||||
return u.scale * deviceScale()
|
||||
if u.deviceScale == 0 {
|
||||
u.deviceScale = deviceScale()
|
||||
}
|
||||
return u.scale * u.deviceScale
|
||||
}
|
||||
|
||||
func (u *userInterface) pollEvents() {
|
||||
|
@ -34,7 +34,6 @@ package ui
|
||||
// static int getCaptionHeight() {
|
||||
// return GetSystemMetrics(SM_CYCAPTION);
|
||||
// }
|
||||
//
|
||||
import "C"
|
||||
|
||||
func deviceScale() float64 {
|
||||
|
Loading…
Reference in New Issue
Block a user