Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SDL 2.0 retina 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);

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.

like image 291
Eamonn Avatar asked Aug 31 '13 05:08

Eamonn


1 Answers

Current versions of SDL2 have support for retina.

To create a retina window, pass a flag SDL_WINDOW_ALLOW_HIGHDPI into SDL_CreateWindow().

After a resize event, you can check the actual buffer resolution with the API call SDL_GL_GetDrawableSize().

like image 51
Bram Avatar answered Oct 09 '22 02:10

Bram