Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS9.1 and iPhone 6/6s Incorrect Resolution #258

Open
Juason opened this issue Oct 30, 2015 · 9 comments
Open

iOS9.1 and iPhone 6/6s Incorrect Resolution #258

Juason opened this issue Oct 30, 2015 · 9 comments
Labels

Comments

@Juason
Copy link

Juason commented Oct 30, 2015

Debugging in simulator or on iPhone 6/6s using XCode 7.1 and latest T2D pull with added code changes to detect and implement 1334x750 resolution for iPhone 6/6s.

The T2D engine and my game are attempting to display everything as though the resolution is 1134x750. However, the top and right side of full-screen images are cropped, as though the actual screen is that of the iPhone 5, or 1136 x 640. Touch inputs in horizontal mode are also off by ~200 pixels below the intended target.

Debugging in XCode is showing the touch input being reported incorrectly from the OS. Again, the touch coordinates stop at the resolution extents of the iPhone 5.

In other words: CGPoint point = [touch locationInView:self]; is returning incorrect coordinates prior to any scaling or other handling.

My knowledge and expertise with iOS development is limited. But I am continuing to investigate this issue. I did see mention that a correctly-sized launch image must be present for the iPhone 6/6s/Plus to work properly. But I've not pursued that just yet.

@chaigler
Copy link
Contributor

@Juason I have no experience with iOS dev, but looking at the code it seems like T2D hardcodes screen sizes for iDevices and creates a window based on those (hardcoded) preferences. If you look at constants.cs & canvas.cs (in AppCore), and Platform::Init() in iOSWindow.mm you'll see the engine attempts to determine the device type by comparing the screen size to certain known values and then stores the result in $pref::iOS::DeviceType. This preference is then used in iOSResolutionFromSetting() (defined in canvas.cs) to determine which resolution to use for T2D's window.

I'm wondering if iOS input can be fixed simply by updating the files I listed above so that they are aware of the new iPhones/iPads?

This all raises another (larger) issue, however: Are all of these hardcoded prefs and hacky "what generation iDevice is this?!" code really necessary? Surely there's a better way of dealing with Apple's yearly releases?

@yurembo
Copy link
Contributor

yurembo commented Nov 23, 2015

I've got the same problem on iOS simulator but on Android device my game runs well.
Does a game run on iPhone / iPad alright?
Does anybody test?

@greenfire27
Copy link
Contributor

@yurembo: Unfortunately it doesn't appear to run well on the latest version of iOS. You and Juason are the ones testing it right now.

@Juason
Copy link
Author

Juason commented Nov 23, 2015

Hello there. Yes as I mentioned in my issue posting, I did modify the code to support the new resolutions. Specifically, I updated the appropriate .mm files with the new resolutions and used debug messaging to the console to ensure they were being set appropriately. As best I can tell the hardware is not correctly handling the higher resolution on my regular iPhone 6/6s. This works fine in the simulator.

I spent several days digging on the Xcode and other iPhone forums trying to identify the root cause. It appears the startup screen's resolution may play a part in determining what resolution the phone adjusts itself to. Though I am unsure where in the Xcode project those startup screens are specified. I see them in the engine folder. But not where the project is using them...

For now I've been successful using my iPhone 6/6s at the iPhone 5s resolution without any noticeable problem. Games work fine on my iPad 3rd Gen as well, and on an iPhone 4 that I used to test with.

@greenfire27
Copy link
Contributor

@Juason So just to be clear, would you say you've corrected the problem at this point? If so we should probably get a pull request together to move your work back into the dev branch of the GG repo. You can find instructions on isolating the commit in it's own branch here.

@kynora
Copy link
Contributor

kynora commented Mar 26, 2016

Is this issue relate to #53 (Fix for the Scene Window Zoom Bug)?

@Juason
Copy link
Author

Juason commented Mar 28, 2016

No, this is still an issue, and it does not appear to be related to #53 in any way. It is a core problem with setting the proper (higher) resolutions on newer iOS devices.

I was never able to resolve it and have simply opted to continued using the incorrect resolution for my iPhone 6/6S.

This week I intend to upgrade everything to iOS 9.3 and see what happens.

@3dDeters
Copy link
Contributor

3dDeters commented Jul 3, 2016

I think the changes in the pull request I just made should fix this for the most part. It doesn't detect the exact resolution of any iPhone 6 model due to the way the hardware actually works, but it still looks just as good in my opinion. Also my changes do away with the need to check a known list of device resolutions.

@greenfire27
Copy link
Contributor

We've merged in the recent fix offered by 3dDeters into the development branch. Can somebody here confirm that this problem has been corrected? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants