Can't get the correct display dimensions on iOS

I am using the iOS Template from the SDL source code. I’m trying to create a window that will cover the whole screen by getting the display mode from “SDL_GetCurrentDisplayMode” and creating a window using the returned width and height.
However, on an iPhone X this function returns the size of roughly an iPhone 4. I have black bars at the top and bottom of the screen.
I did some research and some people suggested adding a launch screen to the project but that doesn’t work with the iOS Template project.
Any ideas about how to get it to create a fullscreen window?

You have to create a launch screen and then tell Xcode about it in the target’s build settings. Under the General tab, in the App Icons and Launch Images section, make the setting Launch Screen File point to MyLaunchScreen.storyboard or whatever.

That didn’t work for me because XCode gives an error when you try to add a launch screen to the Template iOS project that comes with SDL source code. I will probably try to create the project manually instead of using the template.

Nevermind, adding the launch screen worked after renaming the template project. And this also solved my problem! Thanks @sjr for the answer!

1 Like