Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LibGDX iOS RoboVM Landscape Orientation not fullscreen


FIXED IN LIBGDX 1.4.1

Thank you BadLogic, you guys rock!


The project was generated using the gdx-setup.jar file in stable build Version 1.3.1 for testing purposes. (I show later how I update LibGDX to latest snapshot)

Here is a screenshot of the project on a mac desktop:

*** I can't post images, here is the URL: https://i.sstatic.net/4MATG.png

Here is a screenshot of the project on an iPhone 5s:

*** I can't post images, here is the URL: https://i.sstatic.net/I2Wty.png

Here is my build.gradle file from my project root folder.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.robovm:robovm-gradle-plugin:1.0.0-alpha-04'
    }
}

allprojects {
    apply plugin: "eclipse"
    apply plugin: "idea"

    version = '1.0'
    ext {
        appName = 'my-gdx-game'
        gdxVersion = '1.3.2-SNAPSHOT'
        roboVMVersion = '1.0.0-alpha-04'
    }

    repositories {
        mavenCentral()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://oss.sonatype.org/content/repositories/releases/" }
    }
}

After making changes to this file, I refreshed my project using Gradle. It built successfully so I know that it worked.

You can see the I have the latest possible versions of LibGDX and RoboVM. The only change I made to the code generated is the image size fit the screen, showing the inconsistency in screen sizing. Code presented here:

package com.mygdx.game;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class MyGdxGame extends ApplicationAdapter {
    SpriteBatch batch;
    Texture img;

    @Override
    public void create () {
        batch = new SpriteBatch();
        img = new Texture("badlogic.jpg");
    }

    @Override
    public void render () {
        Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        batch.begin();
        batch.draw(img, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); 
        batch.end();
    }

    // The original code is just batch.draw(img, 0, 0);
    // I added a width and height to stretch the image to full screen
    // This change only applies to the image, not resolution or aspect ratio of viewport
}

I'm really struggling to figure this out, any help is greatly appreciated!

like image 745
user3386826 Avatar asked Nov 27 '25 21:11

user3386826


2 Answers

Be sure to check this answer

The file (build.gradle) mentioned in the answer is located at the root of your projects, i.e, in the same folder as your *-ios, *-android, *-core folders.

If the above isn't enough, make sure that your info.plist (it's in your ios project folder) only has landscape orientations, like this:

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

Hope it helps!

like image 84
couceirof Avatar answered Nov 29 '25 11:11

couceirof


iOS 8 and iPhone 6 devices require additional launch images in your RoboVM project's data/ folder. See the *3X.pngs here: https://github.com/libgdx/libgdx/tree/master/extensions/gdx-setup/src/com/badlogic/gdx/setup/resources/ios/data

You also need to update your Eclipse RoboVM plugin if you use that to compile your project. The RoboVM Gradle plugin is ignored when compiling with the RoboVM Eclipse plugin.

like image 34
badlogic Avatar answered Nov 29 '25 10:11

badlogic



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!