mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
ui: deviceScaleFactor -> deviceScale
This commit is contained in:
parent
651d803107
commit
7617a225f6
@ -101,27 +101,27 @@ func ActualScale() int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type userInterface struct {
|
type userInterface struct {
|
||||||
window *glfw.Window
|
window *glfw.Window
|
||||||
width int
|
width int
|
||||||
height int
|
height int
|
||||||
scale int
|
scale int
|
||||||
deviceScaleFactor float64
|
deviceScale float64
|
||||||
framebufferScale int
|
framebufferScale int
|
||||||
context *opengl.Context
|
context *opengl.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterface) start(width, height, scale int, title string) error {
|
func (u *userInterface) start(width, height, scale int, title string) error {
|
||||||
m := glfw.GetPrimaryMonitor()
|
m := glfw.GetPrimaryMonitor()
|
||||||
v := m.GetVideoMode()
|
v := m.GetVideoMode()
|
||||||
mw, _ := m.GetPhysicalSize()
|
mw, _ := m.GetPhysicalSize()
|
||||||
u.deviceScaleFactor = 1
|
u.deviceScale = 1
|
||||||
u.framebufferScale = 1
|
u.framebufferScale = 1
|
||||||
// mw can be 0 on some environment like Linux VM
|
// mw can be 0 on some environment like Linux VM
|
||||||
if 0 < mw {
|
if 0 < mw {
|
||||||
dpi := float64(v.Width) * 25.4 / float64(mw)
|
dpi := float64(v.Width) * 25.4 / float64(mw)
|
||||||
u.deviceScaleFactor = dpi / 96
|
u.deviceScale = dpi / 96
|
||||||
if u.deviceScaleFactor < 1 {
|
if u.deviceScale < 1 {
|
||||||
u.deviceScaleFactor = 1
|
u.deviceScale = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ func (u *userInterface) start(width, height, scale int, title string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterface) windowScale() int {
|
func (u *userInterface) windowScale() int {
|
||||||
return u.scale * int(u.deviceScaleFactor)
|
return u.scale * int(u.deviceScale)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterface) actualScale() int {
|
func (u *userInterface) actualScale() int {
|
||||||
|
Loading…
Reference in New Issue
Block a user