mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
ebiten: change the unit of (*Monitor).Bounds
Monitors can have different device scale factors, and in this case, it doesn't make sense to use device-independent pixels as unit for monitor positions and sizes. Updates #2778
This commit is contained in:
parent
7118057e4f
commit
4da27902f4
@ -40,13 +40,7 @@ type Monitor struct {
|
||||
|
||||
// Bounds returns the monitor's bounds.
|
||||
func (m *Monitor) Bounds() image.Rectangle {
|
||||
ui := Get()
|
||||
return image.Rect(
|
||||
int(ui.dipFromGLFWMonitorPixel(float64(m.x), m.m)),
|
||||
int(ui.dipFromGLFWMonitorPixel(float64(m.y), m.m)),
|
||||
int(ui.dipFromGLFWMonitorPixel(float64(m.x+m.width), m.m)),
|
||||
int(ui.dipFromGLFWMonitorPixel(float64(m.x+m.height), m.m)),
|
||||
)
|
||||
return image.Rect(m.x, m.y, m.x+m.width, m.y+m.height)
|
||||
}
|
||||
|
||||
// Name returns the monitor's name.
|
||||
|
@ -23,7 +23,8 @@ import (
|
||||
// MonitorType represents a monitor available to the system.
|
||||
type MonitorType ui.Monitor
|
||||
|
||||
// Bounds returns the position and size of the monitor in device-independent pixels.
|
||||
// Bounds returns the position and size of the monitor in pixels.
|
||||
// Be careful that the unit is not device-independent pixels.
|
||||
func (m *MonitorType) Bounds() image.Rectangle {
|
||||
return (*ui.Monitor)(m).Bounds()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user