mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
parent
dcb5bb47c6
commit
ff868ba39f
@ -28,6 +28,7 @@ import (
|
|||||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver"
|
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver"
|
||||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/directx"
|
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/directx"
|
||||||
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl"
|
"github.com/hajimehoshi/ebiten/v2/internal/graphicsdriver/opengl"
|
||||||
|
"github.com/hajimehoshi/ebiten/v2/internal/microsoftgdk"
|
||||||
)
|
)
|
||||||
|
|
||||||
type graphicsDriverGetterImpl struct {
|
type graphicsDriverGetterImpl struct {
|
||||||
@ -155,6 +156,10 @@ func (u *userInterfaceImpl) dipToGLFWPixel(x float64, monitor *glfw.Monitor) flo
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *userInterfaceImpl) adjustWindowPosition(x, y int, monitor *glfw.Monitor) (int, int) {
|
func (u *userInterfaceImpl) adjustWindowPosition(x, y int, monitor *glfw.Monitor) (int, int) {
|
||||||
|
if microsoftgdk.IsXbox() {
|
||||||
|
return x, y
|
||||||
|
}
|
||||||
|
|
||||||
mx, my := monitor.GetPos()
|
mx, my := monitor.GetPos()
|
||||||
// As the video width/height might be wrong,
|
// As the video width/height might be wrong,
|
||||||
// adjust x/y at least to enable to handle the window (#328)
|
// adjust x/y at least to enable to handle the window (#328)
|
||||||
@ -172,6 +177,10 @@ func (u *userInterfaceImpl) adjustWindowPosition(x, y int, monitor *glfw.Monitor
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initialMonitorByOS() (*glfw.Monitor, error) {
|
func initialMonitorByOS() (*glfw.Monitor, error) {
|
||||||
|
if microsoftgdk.IsXbox() {
|
||||||
|
return glfw.GetPrimaryMonitor(), nil
|
||||||
|
}
|
||||||
|
|
||||||
px, py, err := _GetCursorPos()
|
px, py, err := _GetCursorPos()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -190,6 +199,9 @@ func initialMonitorByOS() (*glfw.Monitor, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func monitorFromWindowByOS(w *glfw.Window) *glfw.Monitor {
|
func monitorFromWindowByOS(w *glfw.Window) *glfw.Monitor {
|
||||||
|
if microsoftgdk.IsXbox() {
|
||||||
|
return glfw.GetPrimaryMonitor()
|
||||||
|
}
|
||||||
return monitorFromWin32Window(windows.HWND(w.GetWin32Window()))
|
return monitorFromWin32Window(windows.HWND(w.GetWin32Window()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user