本文整理汇总了Golang中github.com/jackyb/go-sdl2/sdl.Window.GetWMInfo方法的典型用法代码示例。如果您正苦于以下问题:Golang Window.GetWMInfo方法的具体用法?Golang Window.GetWMInfo怎么用?Golang Window.GetWMInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/jackyb/go-sdl2/sdl.Window
的用法示例。
在下文中一共展示了Window.GetWMInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
var window *sdl.Window
var info sdl.SysWMInfo
var subsystem string
window = sdl.CreateWindow("", 0, 0, 0, 0, sdl.WINDOW_HIDDEN)
if window == nil {
fmt.Fprintf(os.Stderr, "Failed to create window: %s\n", sdl.GetError())
os.Exit(1)
}
sdl.VERSION(&info.Version)
if window.GetWMInfo(&info) {
switch info.Subsystem {
case sdl.SYSWM_UNKNOWN:
subsystem = "An unknown system!"
case sdl.SYSWM_WINDOWS:
subsystem = "Microsoft Windows(TM)"
case sdl.SYSWM_X11:
subsystem = "X Window System"
case sdl.SYSWM_DIRECTFB:
subsystem = "DirectFB"
case sdl.SYSWM_COCOA:
subsystem = "Apple OS X"
case sdl.SYSWM_UIKIT:
subsystem = "UIKit"
}
fmt.Printf("This program is running SDL version %d.%d.%d on %s\n",
info.Version.Major,
info.Version.Minor,
info.Version.Patch,
subsystem)
} else {
fmt.Fprintf(os.Stderr, "Couldn't get window information: %s\n", sdl.GetError())
}
window.Destroy()
}