本文整理匯總了Golang中github.com/veandco/go-sdl2/sdl.Window.GetWMInfo方法的典型用法代碼示例。如果您正苦於以下問題:Golang Window.GetWMInfo方法的具體用法?Golang Window.GetWMInfo怎麽用?Golang Window.GetWMInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/veandco/go-sdl2/sdl.Window
的用法示例。
在下文中一共展示了Window.GetWMInfo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: main
func main() {
var window *sdl.Window
var info sdl.SysWMInfo
var subsystem string
var err error
window, err = sdl.CreateWindow("", 0, 0, 0, 0, sdl.WINDOW_HIDDEN)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to create window: %s\n", err)
os.Exit(1)
}
defer window.Destroy()
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())
}
}