设备坐标系和libgdx之间的差异

时间:2015-12-15 17:17:32

标签: android libgdx viewport galaxy coordinate

我遇到了libgdx和设备坐标系的问题。 对于galaxy S I我有一个坐标系,左边高角有(0,0)坐标,y轴有新月向下。即我的样本:

x=0,y=device height
_________________________x=device width

    |
    |
    |
    |

x=0,y=0

我的应用程序最终在星系S4工作正常我有下一个sistuation:

x0=y=0
______________________________________
|
|
|
|
x=0,y=device height

结果,图像旋转180度。 请问,我如何建立一个独立于设备的坐标系? 感谢您的关注。

编辑: 在启动画面中,我在构造函数

中设置了此代码
 camera = new OrthographicCamera();
        camera.setToOrtho(false, Constants.APP_WIDTH, Constants.APP_HEIGHT);
        texture = new Texture(Gdx.files.internal("sfondosplashscreen.png"));
        viewport = new FitViewport(texture.getWidth(), texture.getHeight());

以及resize方法中的以下代码

 @Override
    public void resize(int width, int height) {
        viewport.update(width, height);
    }

这两项设备的工作。

在主菜单中,我使用相同的代码。在银河系的工作和星系s4中没有工作.....

0 个答案:

没有答案