dongtun2572 2014-07-08 12:00
浏览 425
已采纳

在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 07:49
    关注

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

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部