在SDL 2中获取屏幕分辨率

I'm trying to get the native screen resolution and create a window of that size using sdl 2 (github.com/veandco/go-sdl2/sdl) and go. This is what I tried:

var desktop sdl.DisplayMode
sdl.GetDesktopDisplayMode(0, &desktop)
mainwindow := sdl.CreateWindow("Test App", sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED, desktop.W, desktop.H, sdl.WINDOW_OPENGL | sdl.WINDOW_FULLSCREEN)

When I use this the size of the resulting window is always 0, 0 what am I doing wrong?

Platform is x86_64 Linux using the X-server.

Try using sdl.WINDOW_FULLSCREEN_DESKTOP instead of sdl.WINDOW_FULLSCREEN. It should go fullscreen at the current resolution.