mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +01:00
parent
f8163f93c0
commit
05d49c5a52
@ -44,3 +44,18 @@ func isXbox() bool {
|
|||||||
t := C.XSystemGetDeviceType()
|
t := C.XSystemGetDeviceType()
|
||||||
return t != _XSystemDeviceType_Unknown && t != _XSystemDeviceType_Pc
|
return t != _XSystemDeviceType_Unknown && t != _XSystemDeviceType_Pc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func monitorResolution() (int, int) {
|
||||||
|
switch C.XSystemGetDeviceType() {
|
||||||
|
case _XSystemDeviceType_XboxOne, _XSystemDeviceType_XboxOneS:
|
||||||
|
return 1920, 1080
|
||||||
|
case _XSystemDeviceType_XboxScarlettLockhart:
|
||||||
|
// Series S
|
||||||
|
return 2560, 1440
|
||||||
|
case _XSystemDeviceType_XboxOneX, _XSystemDeviceType_XboxOneXDevkit, _XSystemDeviceType_XboxScarlettAnaconda, _XSystemDeviceType_XboxScarlettDevkit:
|
||||||
|
// Series X
|
||||||
|
return 3840, 2160
|
||||||
|
default:
|
||||||
|
return 1920, 1080
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -20,3 +20,7 @@ package glfwwin
|
|||||||
func isXbox() bool {
|
func isXbox() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func monitorResolution() (int, int) {
|
||||||
|
panic("glfwwin: monitorResolution is not implemented in this environment")
|
||||||
|
}
|
||||||
|
@ -259,9 +259,25 @@ func platformInit() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if isXbox() {
|
if isXbox() {
|
||||||
// TODO: Create a dummy window.
|
// On Xbox, APIs to get monitors are not available.
|
||||||
// The resolution can be deterined based on a device.
|
// Create a pseudo monitor instance instead.
|
||||||
// See https://github.com/microsoft/Xbox-GDK-Samples/blob/1f44bdabed6e340170e2c7d1007500e4dff897bb/Samples/IntroGraphics/SimpleDynamicResources/Main.cpp#L118-L148
|
w, h := monitorResolution()
|
||||||
|
mode := &VidMode{
|
||||||
|
Width: w,
|
||||||
|
Height: h,
|
||||||
|
RedBits: 8,
|
||||||
|
GreenBits: 8,
|
||||||
|
BlueBits: 8,
|
||||||
|
RefreshRate: 0, // TODO: Is it possible to get an appropriate refresh rate?
|
||||||
|
}
|
||||||
|
m := &Monitor{
|
||||||
|
name: "Xbox Monitor",
|
||||||
|
modes: []*VidMode{mode},
|
||||||
|
currentMode: mode,
|
||||||
|
}
|
||||||
|
if err := inputMonitor(m, Connected, _GLFW_INSERT_LAST); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := pollMonitorsWin32(); err != nil {
|
if err := pollMonitorsWin32(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user