ebiten: remove (*Monitor).Bounds()

Now the unit of Bounds is device-dependent pixels, and this is useless
and Ebitengine API always treat device-independent pixels. Rather,
this might confuse users.

Until we find a good solution, let's remove Bounds() for v2.6.
MonitorType itself is still useful to specify a monitor to show a
window.

Closes #2780
This commit is contained in:
Hajime Hoshi 2023-09-23 18:24:03 +09:00
parent 4da27902f4
commit 0170598a82
2 changed files with 1 additions and 9 deletions

View File

@ -57,7 +57,7 @@ func (g *Game) Draw(screen *ebiten.Image) {
lines = append(lines, "") lines = append(lines, "")
for i, m := range g.monitors { for i, m := range g.monitors {
lines = append(lines, fmt.Sprintf("%d: %s %s", i, m.Name(), m.Bounds().String())) lines = append(lines, fmt.Sprintf("%d: %s", i, m.Name()))
} }
activeMonitor := ebiten.Monitor() activeMonitor := ebiten.Monitor()

View File

@ -15,20 +15,12 @@
package ebiten package ebiten
import ( import (
"image"
"github.com/hajimehoshi/ebiten/v2/internal/ui" "github.com/hajimehoshi/ebiten/v2/internal/ui"
) )
// MonitorType represents a monitor available to the system. // MonitorType represents a monitor available to the system.
type MonitorType ui.Monitor type MonitorType ui.Monitor
// 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()
}
// Name returns the monitor's name. On Linux, this reports the monitors in xrandr format. // Name returns the monitor's name. On Linux, this reports the monitors in xrandr format.
// On Windows, this reports "Generic PnP Monitor" for all monitors. // On Windows, this reports "Generic PnP Monitor" for all monitors.
func (m *MonitorType) Name() string { func (m *MonitorType) Name() string {