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

LibGDX doesn't scale properly on iPhone 6+ or iPhone 6 in zoomed mode #2356

Closed
PaulMaxime opened this issue Sep 20, 2014 · 27 comments
Closed

LibGDX doesn't scale properly on iPhone 6+ or iPhone 6 in zoomed mode #2356

PaulMaxime opened this issue Sep 20, 2014 · 27 comments
Labels

Comments

@PaulMaxime
Copy link

@PaulMaxime PaulMaxime commented Sep 20, 2014

in IOSGraphics.java, the code only handles device scale == 2. Since the 6+ has scale of 3, games are shrunk to a corner of the screen in the 6+. We need to modify this to simply multiply by the scale in all cases.

There is also a perhaps more subtle bug on the iPhone 6 in "zoomed" mode. In a similar way, the game is restricted to a corner of the screen. Not exactly sure here what the fix is, still diagnosing it.

@milos1290
Copy link

@milos1290 milos1290 commented Sep 21, 2014

Bumping this, since this is one of the critical issues that needs to be prioritized.

@johnnyapol
Copy link
Member

@johnnyapol johnnyapol commented Sep 21, 2014

The team is aware of this issue and we are working on a solution.

@johnnyapol
Copy link
Member

@johnnyapol johnnyapol commented Sep 21, 2014

Going to reference #2350 as these are very related.

@PaulMaxime
Copy link
Author

@PaulMaxime PaulMaxime commented Sep 21, 2014

Make sure you check zoomed mode. There is a nativeScale method on UIScreen in 8 that returns a non-integer value in zoomed mode. You'll need to use it instead of scale on 8.

Paul Franceus, paul@blueiris.us
Absolute power doesn't corrupt, it reveals -- Erwin McManus

On Sep 21, 2014, at 7:24 AM, John notifications@github.com wrote:

Going to reference #2350 as these are very related.


Reply to this email directly or view it on GitHub.

@badlogic
Copy link
Member

@badlogic badlogic commented Sep 21, 2014

I'm currently busy figuring out RoboVM issues on iOS 8. Once we have that
fixed i'll fix this one up.
On Sep 21, 2014 5:14 PM, "Paul Franceus" notifications@github.com wrote:

Make sure you check zoomed mode. There is a nativeScale method on UIScreen
in 8 that returns a non-integer value in zoomed mode. You'll need to use it
instead of scale on 8.

Paul Franceus, paul@blueiris.us
Absolute power doesn't corrupt, it reveals -- Erwin McManus

On Sep 21, 2014, at 7:24 AM, John notifications@github.com wrote:

Going to reference #2350 as these are very related.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#2356 (comment).

@mothi
Copy link

@mothi mothi commented Sep 22, 2014

Hi
I had this problem in my landscape game. I made an ugly workaround and the game works in native resolution (not in zoomed mode) im all devices in iOS8.

switch (orientation) {
        case LandscapeLeft:
        case LandscapeRight:
            height = (int)bounds.width();
            width = (int)bounds.height();
              if(width < height){  // workaround
                    width = (int) bounds.width(); // workaround
                    height = (int) bounds.height(); // workaround
                            } // workaround
            break;
        default:
            // assume portrait
            width = (int)bounds.width();
            height = (int)bounds.height();
        }
  • then I created custom launch images for iPhone 5/5S, iPhone 6, iPhone 6 Plus and iPhone 4s:
File Name Resolution Device
Default-568h@2x.png 640 x 1136 iPhone 5/5s
Default-667h@2x.png 750 x 1334 iPhone 6
Default-736h@3x.png 2208 x 1242 iPhone 6+
Default.png 320 x 480 iPhone 3gs
Default@2x.png 640 x 960 iPhone 4/4s
Default@2x~ipad.png 1536 x 2008 iPad < iOS8
Default~ipad.png 768 x 1004 iPad < iOS8
Default8@2x~ipad.png 2008 x 1536 iPad iOS8
Default8~ipad.png 1004 x 768 iPad iOS8
  • I specified these files in Info.plist.xml :
    <key>UILaunchImages</key>
    <array>

    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-667h</string>
        <key>UILaunchImageOrientation</key>
        <string>Landscape</string>
        <key>UILaunchImageSize</key>
        <string>{375, 667}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-736h</string>
        <key>UILaunchImageOrientation</key>
        <string>Landscape</string>
        <key>UILaunchImageSize</key>
        <string>{414, 736}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-568h</string>
        <key>UILaunchImageOrientation</key>
        <string>Landscape</string>
        <key>UILaunchImageSize</key>
        <string>{320, 568}</string>
    </dict>
        <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-667h</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{375, 667}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-736h</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{414, 736}</string>
    </dict>
    <dict>
        <key>UILaunchImageMinimumOSVersion</key>
        <string>8.0</string>
        <key>UILaunchImageName</key>
        <string>Default-568h</string>
        <key>UILaunchImageOrientation</key>
        <string>Portrait</string>
        <key>UILaunchImageSize</key>
        <string>{320, 568}</string>
    </dict>


     <dict>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>8.0</string>
            <key>UILaunchImageName</key>
            <string>Default</string>
            <key>UILaunchImageOrientation</key>
            <string>Portrait</string>
            <key>UILaunchImageSize</key>
            <string>{320, 480}</string>
        </dict>
        <dict>
            <key>UILaunchImageMinimumOSVersion</key>
            <string>8.0</string>
            <key>UILaunchImageName</key>
            <string>Default</string>
            <key>UILaunchImageOrientation</key>
            <string>Landscape</string>
            <key>UILaunchImageSize</key>
            <string>{320, 480}</string>
        </dict>
        </array>
<key>UILaunchImages~ipad</key>
  <array>
          <dict>
      <key>UILaunchImageMinimumOSVersion</key>
      <string>8.0</string>
      <key>UILaunchImageName</key>
      <string>Default8</string>
      <key>UILaunchImageOrientation</key>
      <string>Portrait</string>
      <key>UILaunchImageSize</key>
      <string>{768, 1024}</string>
    </dict>
    <dict>
      <key>UILaunchImageMinimumOSVersion</key>
      <string>8.0</string>
      <key>UILaunchImageName</key>
      <string>Default8</string>
      <key>UILaunchImageOrientation</key>
      <string>Landscape</string>
      <key>UILaunchImageSize</key>
      <string>{768, 1024}</string>
    </dict>
  </array>
@ericnondahl
Copy link
Contributor

@ericnondahl ericnondahl commented Sep 23, 2014

Can confirm using nativeScale (available in iOS 8) fixes this issue on the normal iPhone 6 in zoomed mode. I don't have a 6+ to test with, however, and the sim isn't launching for the 6+.

@badlogic
Copy link
Member

@badlogic badlogic commented Sep 23, 2014

Hey folks, i hope i cam fix this up tomorrow. We've been busy getting
RoboVM up to speed with iOS 8, which we finished today. Should be able to
fix this up properly tomorrow.
On Sep 23, 2014 9:14 PM, "Eric Nondahl" notifications@github.com wrote:

Can confirm using nativeScale (available in iOS 8) fixes this issue on the
normal iPhone 6 in zoomed mode. I don't have a 6+ to test with, however,
and the sim isn't launching for the 6+.


Reply to this email directly or view it on GitHub
#2356 (comment).

@badlogic
Copy link
Member

@badlogic badlogic commented Sep 24, 2014

RoboVM doesn't yet expose the nativeScale method. Will fix this as soon as that's done on the RoboVM side.

@magfort
Copy link

@magfort magfort commented Sep 26, 2014

Could anyone explain how they're using native resolution/nativeScale in the mean time?

I've been receiving complaints from iPhone 6 users that the scale in my game is wrong and I'm not really sure how to fix this.

@PaulMaxime
Copy link
Author

@PaulMaxime PaulMaxime commented Sep 26, 2014

We patched everything ourselves
On Sep 25, 2014 10:17 PM, "dougcowley" notifications@github.com wrote:

Could anyone explain how they're using native resolution/nativeScale in
the mean time?

I've been receiving complaints from iPhone 6 users and I'm not really sure
how to fix this.


Reply to this email directly or view it on GitHub
#2356 (comment).

@badlogic
Copy link
Member

@badlogic badlogic commented Sep 26, 2014

This should be fixed in the latest nightlies.
On Sep 26, 2014 7:22 AM, "Paul Franceus" notifications@github.com wrote:

We patched everything ourselves
On Sep 25, 2014 10:17 PM, "dougcowley" notifications@github.com wrote:

Could anyone explain how they're using native resolution/nativeScale in
the mean time?

I've been receiving complaints from iPhone 6 users and I'm not really
sure
how to fix this.


Reply to this email directly or view it on GitHub
#2356 (comment).


Reply to this email directly or view it on GitHub
#2356 (comment).

@jhouston
Copy link

@jhouston jhouston commented Sep 26, 2014

Can confirm that building this morning with

gdxVersion = '1.3.2-SNAPSHOT'
roboVMVersion = '1.0.0-alpha-02'

fixed the issue for me. Thanks!

@ChetRippo
Copy link
Contributor

@ChetRippo ChetRippo commented Sep 30, 2014

Worked for me as well!

@perchi
Copy link

@perchi perchi commented Oct 1, 2014

With the latest nightly build i have problems with input events (clicks) which are not workig! Anyone else have similar problems (on iOS 8)? Tnx!

ext {
gdxVersion = '1.3.2-SNAPSHOT'
roboVMVersion = '1.0.0-SNAPSHOT'
}
touch events were working on version 1.3.0 ... but there is a problem with rotation and screen size ... so what to do? :D

@perchi
Copy link

@perchi perchi commented Oct 1, 2014

This is happening only on iOS devices ... on Android and Desktop is working as expected ...

@Tom-Ski
Copy link
Member

@Tom-Ski Tom-Ski commented Oct 2, 2014

Please create a new issue with an executable example that reproduces your problem.

Closing this out.

@Tom-Ski Tom-Ski closed this Oct 2, 2014
@magfort
Copy link

@magfort magfort commented Oct 3, 2014

Was this commit intended to fix the issue? 062de10

The commit comment suggests it was just preparing for the fix, not fixing it.

in iosrobovm/IOSApplication.java
line 123: scale is always equal to 2.0f due to the condition on line 120 so the change in this commit has no effect.

On the iPhone 6 Plus, my app still only fills 2/3 of the width and 2/3 of the height.

Am I missing something or is this issue not actually fixed?

@badlogic
Copy link
Member

@badlogic badlogic commented Oct 3, 2014

Zoomed mode has not been fixed as RoboVM lacks a binding to the nativeScale
method.
On Oct 3, 2014 6:29 AM, "dougcowley" notifications@github.com wrote:

Was this commit intended to fix the issue? 062de10
062de10

The commit comment suggests it was just preparing for the fix, not fixing
it.

scale is always equal to 2.0f due to the condition on line 120 so the
change in this commit has no effect.

On the iPhone 6 Plus, my app only fills 2/3 of the width and 2/3 of the
height.


Reply to this email directly or view it on GitHub
#2356 (comment).

@magfort
Copy link

@magfort magfort commented Oct 3, 2014

I've made the following change locally and it seems to solve this issue:
removed line 120 and 131-140 of https://github.com/libgdx/libgdx/blob/master/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplication.java

Is there a problem with this simple solution? I've tested it across all iOS 8 devices in the simulator and each has the correct scaling with the fix. Without the fix, the iPhone 6 Plus is the only one scaled incorrectly.

@badlogic badlogic reopened this Oct 3, 2014
@badlogic
Copy link
Member

@badlogic badlogic commented Oct 3, 2014

OK, this is all kinds of fucked it seems. I can get the nativeScale now (conditional on OS version). On iOS 8 on an iPhone 6 (plus) i get funky black bars to the left and right. UIScreen.getMainScreen().getBounds() reports 480x320, the scale is 3 on an iphone 6 plus, resulting in a width/height of 1440*960, on an iPhone 6 the scale is 2 resulting in 960x640 pixels scaled.

This introduces funky black bars: http://libgdx.badlogicgames.com/uploads/Screen%20Shot%202014-10-03%20at%2017.11.41-CRQw8sLJcg.png

I know nothing about iOS UI programming, anybody got an idea?

@badlogic
Copy link
Member

@badlogic badlogic commented Oct 3, 2014

So, here's the commit with the latest "fixes" 5f28c1f No idea how to get the proper native screen resolution. Both scale and nativeScale return integer values, resulting in wrong pixel resolution and hence the black bars of death. Any hints appreciated.

@mikemee
Copy link
Contributor

@mikemee mikemee commented Oct 3, 2014

@badlogic
Copy link
Member

@badlogic badlogic commented Oct 3, 2014

@ericnondahl right, the problem is that the point sizes are wrong for iPhone 6(+). They stay at 480x320. I hope we don't have to add a launch screen...

@badlogic
Copy link
Member

@badlogic badlogic commented Oct 3, 2014

OK, launch images do the trick and let our apps run in "native" resolution. What a stupid trick...

Fixed with the latest commit, should be available in the nightlies soon.

@badlogic badlogic closed this Oct 3, 2014
@magfort
Copy link

@magfort magfort commented Oct 4, 2014

It's all working for me with latest nightly.

Thanks

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

Successfully merging a pull request may close this issue.

None yet
You can’t perform that action at this time.