SFML community forums

Help => General => Topic started by: jonc on October 07, 2021, 01:14:48 pm

Title: How to shrink screen on iOS
Post by: jonc on October 07, 2021, 01:14:48 pm
iOS screen/window is cropped on multiple iOS devices. How do I shrink the screen/window on iOS? For example if I write the code:

sf::RenderWindow window;
window.create(sf::VideoMode(960, 540), "Title", sf::Style::Close);

I believe on IPhone 11 it will ignore the 960 x 540 that I specified and use 896 x 414 since when I call std::vector<sf::VideoMode> modes = sf::VideoMode::getFullscreenModes(); it returns back 896 x 414 and the window is cropped. I want to shrink the screen to fit 896 x 414. I don't want to use view.zoom() which I tried but it causes the text to be blurry. I tested the code on Android and I did not see any cropping issues.

I been looking at WindowImplUIKit::WindowImplUIKit in SFML/src/SFML/Window/iOS/WindowImplUIKit.mm
and I also looked at SFML/src/SFML/Window/iOS/SFView.mm. I am not familiar with Objective C so it has been difficult for me to understand what is going on.

Edit: I figured it out. If anyone wants to resize the window without using view.zoom() one can update [SFAppDelegate getInstance].backingScaleFactor in WindowImplUIKit::WindowImplUIKit in SFML/src/SFML/Window/iOS/WindowImplUIKit.mm