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

Invalid screen coordinates in ios #5272

Closed
6 tasks
kali-gandaki opened this issue Jun 17, 2018 · 8 comments
Closed
6 tasks

Invalid screen coordinates in ios #5272

kali-gandaki opened this issue Jun 17, 2018 · 8 comments

Comments

@kali-gandaki
Copy link

Please ensure you have given all the following requested information in your report.

Issue details

I am not sure whether the issue is with robovm or libgdx . I apologize in advance if i posted in wrong place. I have a game which run in landscape mode. Previous builds use to work fine but the latest builds have a issue . Screen coordinates in a stage translates in portrait mode even though app launches in landscape mode . This bug did exist some time ago during the age of ios7 and ios8 but was fixed. I can confirm that this issue exists only when app runs in ios real devices. I have tested in phone 6s and 7 plus ( not in simulator , apparently everything works fine in simulator ).
Please check the code below. The stage seems to initialize with 720 as width and height . when clicked in top right it returns coordinates around 600s ..( both x and y ) . It should have return in the range of 1100 / 100 . The screen is full screen with status bar hidden .

Reproduction steps/code

public class TestScreen implements Screen {

SpriteBatch spriteBatch = new SpriteBatch();
Stage stage;
@Override
public void show() {
    stage = new Stage(new FitViewport(1280,720), spriteBatch);
    Gdx.input.setInputProcessor(stage);
    stage.setDebugAll(true);
    stage.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Gdx.app.log("Screen","Clicked coordinates are "+x+ "and" +y);
        }
    });
}
@Override
public void render(float delta) {
    stage.act(delta);
    stage.draw();
}

......

//Info.plist config

UIViewControllerBasedStatusBarAppearance

UIStatusBarHidden

UIRequiresFullScreen

MinimumOSVersion
10.0
UIRequiredDeviceCapabilities

armv7
opengles-2

UISupportedInterfaceOrientations

UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight

libgdx version : 1.9.8
robovm version : 2.3.3
robovm intellij plugin : 2.3.4.Snapshot
IOS version in device : 11.4

Please select the affected platforms

  • Android
  • [ *] iOS (robovm)
  • iOS (MOE)
  • HTML/GWT
  • Windows
  • Linux
  • MacOS
@kali-gandaki
Copy link
Author

#2105 issue seems similar to this one

@kali-gandaki
Copy link
Author

MobiVM/robovm#302 seems to fix the issue on real devices. But the problem is still there as now the simulators has started to act in a similar way.

@mikemee
Copy link
Contributor

mikemee commented Jul 3, 2018

Not sure if this is the same thing, but my app was returning portrait touch coordinates in landscape, but displaying fine in landscape.

Adding the line <iosSdkVersion>11.4</iosSdkVersion> into robovm.xml suggested here fixed it for me. (After also installing MobiVM 2.3.4 which has the 302 fix).

@kali-gandaki
Copy link
Author

New version 2.3.4 of robovm fixes this issue. thanks

@pablitar
Copy link

Hello! I'm getting the touch events in iOS to be reported as if the app was in portrait mode, when it is actually in landscape.

I'm running RoboVM 2.3.5 with LibGDX 1.9.8.

My robovm.xml looks like this: https://gist.github.com/pablitar/dd80c5fb33c99d5bf01220aaa33738dc

And my Info.plist.xml looks like this: https://gist.github.com/pablitar/6a14c65202dd1eaefb9807ec5ed4cb77

It should be noted that I'm seeing the issue in a simulator, but since I don't have a real iOS device to test, I would need this to work alright.

Is it related to this issue? Is there a workaround?

Thanks in advance!

@kali-gandaki
Copy link
Author

try adding <iosSdkVersion>11.4</iosSdkVersion> into robovm.xml as commented above

@pablitar
Copy link

@kali-gandaki It is there already: https://gist.github.com/pablitar/dd80c5fb33c99d5bf01220aaa33738dc

Is that key added correctly?

@pablitar
Copy link

I just tested the app with a real device and it works as expected, so it is a problem with the simulator only.

In the weekend I'll see if I can reproduce the issue with a clean project, and I'll share the source code. Maybe is a problem with my Mac OS environment.

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

No branches or pull requests

3 participants