mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
internal/ui: refactoring: remove redundant Monitor members
This commit is contained in:
parent
121d6005cd
commit
f72b8a4ced
@ -28,13 +28,11 @@ import (
|
|||||||
type Monitor struct {
|
type Monitor struct {
|
||||||
m *glfw.Monitor
|
m *glfw.Monitor
|
||||||
vm *glfw.VidMode
|
vm *glfw.VidMode
|
||||||
// Pos of monitor in virtual coords
|
|
||||||
x int
|
id int
|
||||||
y int
|
name string
|
||||||
width int
|
x int
|
||||||
height int
|
y int
|
||||||
id int
|
|
||||||
name string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name returns the monitor's name.
|
// Name returns the monitor's name.
|
||||||
@ -91,16 +89,13 @@ func (m *monitors) update() {
|
|||||||
newMonitors := make([]*Monitor, 0, len(glfwMonitors))
|
newMonitors := make([]*Monitor, 0, len(glfwMonitors))
|
||||||
for i, m := range glfwMonitors {
|
for i, m := range glfwMonitors {
|
||||||
x, y := m.GetPos()
|
x, y := m.GetPos()
|
||||||
vm := m.GetVideoMode()
|
|
||||||
newMonitors = append(newMonitors, &Monitor{
|
newMonitors = append(newMonitors, &Monitor{
|
||||||
m: m,
|
m: m,
|
||||||
vm: m.GetVideoMode(),
|
vm: m.GetVideoMode(),
|
||||||
x: x,
|
id: i,
|
||||||
y: y,
|
name: m.GetName(),
|
||||||
width: vm.Width,
|
x: x,
|
||||||
height: vm.Height,
|
y: y,
|
||||||
name: m.GetName(),
|
|
||||||
id: i,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,8 +307,8 @@ func (u *userInterfaceImpl) setWindowMonitor(monitor *Monitor) {
|
|||||||
w := u.dipToGLFWPixel(float64(ww), monitor.m)
|
w := u.dipToGLFWPixel(float64(ww), monitor.m)
|
||||||
h := u.dipToGLFWPixel(float64(wh), monitor.m)
|
h := u.dipToGLFWPixel(float64(wh), monitor.m)
|
||||||
x, y := monitor.x, monitor.y
|
x, y := monitor.x, monitor.y
|
||||||
mw := u.dipFromGLFWMonitorPixel(float64(monitor.width), monitor.m)
|
mw := u.dipFromGLFWMonitorPixel(float64(monitor.vm.Width), monitor.m)
|
||||||
mh := u.dipFromGLFWMonitorPixel(float64(monitor.height), monitor.m)
|
mh := u.dipFromGLFWMonitorPixel(float64(monitor.vm.Height), monitor.m)
|
||||||
mw = u.dipToGLFWPixel(mw, monitor.m)
|
mw = u.dipToGLFWPixel(mw, monitor.m)
|
||||||
mh = u.dipToGLFWPixel(mh, monitor.m)
|
mh = u.dipToGLFWPixel(mh, monitor.m)
|
||||||
px, py := InitialWindowPosition(int(mw), int(mh), int(w), int(h))
|
px, py := InitialWindowPosition(int(mw), int(mh), int(w), int(h))
|
||||||
|
Loading…
Reference in New Issue
Block a user