2014-07-08 20:00
浏览 328

在SDL 2中获取屏幕分辨率

I'm trying to get the native screen resolution and create a window of that size using sdl 2 ( 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.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duancheng6221
    duancheng6221 2014-08-05 15:49

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

    点赞 评论