Device Independent Resolution

Category: SDL Adventure Game

Initially, I set a fixed window size of 800x600, but this caused issues as the iPhone screen is smaller and the iPad screen is larger. On the iPhone, most of the game screen was not visible, making it impossible to play:

iPhone before window size fix

On the iPad, the game looked broken, occupying only a small portion of the screen:

iPad before window size fix

I resolved this issue by calling SDL_RenderSetLogicalSize in the initialization function:

1
SDL_RenderSetLogicalSize(renderer, WINDOW_WIDTH, WINDOW_HEIGHT);

Here’s the result on the iPhone after implementing the solution:

iPhone after window size fix

And on the iPad after the fix:

iPad after window size fix

Next: Refresh Rate Independent Animations and Game-Speed-Dependent Updates