dongtun2572
2014-07-08 20:00
浏览 377
已采纳

在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.

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • 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.

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题