Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have multiple classes that implement Screen.

I want to, say, have the Main Menu screen portrait, then the Play Screen landscape. Is there anyway of changing the orientation dynamically?

I thought I could just start another Activity and have the Play Screen extend Game. And the new Activity would intialize the Play Screen. But it appears that you can't call startActivity or the like, obviously, as LibGDX is platform independent.

I use Gdx.graphics.getWidth() and Gdx.graphics.getHeight() to align Sprites and Actors so it looks "right" on different devices.

I've also tried swapping the Gdx.graphics.getWidth() and Gdx.graphics.getHeight(), respectively, but can't seem to get the position of sprites and actors correct.

share|improve this question
add comment

1 Answer 1

I figured out how to do it.

I used an interface as shown at this link

Basically, I created an interface in the core project, then for each back-end project I implements my interface.

To change the orientation in Android is simple as shown here

That is, setRequestedOrientation(ActivityInfo.<THE_ORIENTATION>)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.