SDL 2.0视网膜Mac [英] SDL 2.0 retina mac
问题描述
我一直在使用SDL 2.0,但是在搜索之后,我没有在网上找到有关如何支持视网膜Mac的任何信息.使用以下代码创建窗口时.
I have been playing around with SDL 2.0 but after searching I haven't found anything online about how to support retina macs. When creating a window using the following code.
gWindow = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED, 500, 500, SDL_WINDOW_SHOWN);
它将创建一个实际尺寸为1000 * 1000的窗口.这并不是一个真正的问题,因为应该使用hidpi屏幕来使应用程序正常工作.但是,在加载图像时,我似乎找不到找到加载视网膜屏幕尺寸2倍的图像的方法,并且图像始终看起来很模糊.
It creates a window that has an actual size of 1000 * 1000. This isn't really an issue because it's how apps are supposed to work using a hidpi screen. However, when loading images I can't seem to find a way to load images that are 2x as big for retina screens and my images always look blurry.
推荐答案
当前版本的SDL2支持视网膜.
Current versions of SDL2 have support for retina.
要创建视网膜窗口,请将标志SDL_WINDOW_ALLOW_HIGHDPI
传递到SDL_CreateWindow()
.
To create a retina window, pass a flag SDL_WINDOW_ALLOW_HIGHDPI
into SDL_CreateWindow()
.
在调整大小事件之后,您可以使用API调用SDL_GL_GetDrawableSize()
检查实际的缓冲区分辨率.
After a resize event, you can check the actual buffer resolution with the API call SDL_GL_GetDrawableSize()
.
这篇关于SDL 2.0视网膜Mac的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!