简体   繁体   中英

Will Android Game Automatically Fill Screen? (LibGDX Android Game Dev)

I'm new to android development and have used LibGDX once before. I'm excited to use it again, but this time to make an Android game instead of a desktop one and had a couple questions.

1) I understand different devices have different aspect ratios. I think if I can get the width/height of the phone, I can manually scale my game to be able to work on any device. My main question is, though, will my LibGDX game automatically fill the screen, or is there some generic width/height it resorts to when no width/height is specified? I know I can use the commands:

Gdx.app.getGraphics().getWidth(); and Gdx.app.getGraphics().getHeight();

To get the width and height of the program, but will it automatically be set to the width and height of the phone? Sorry if this is a dumb question, I'm really a beginner.

Also, can anyone recommend me a link to a tutorial or just explain to me the general process I'll go through to get my android game on the android market after making the game on Eclipse using LibGDX? Just want to make sure it's not too difficult, if it is I might switch to Android Studio? I like Eclipse though, if possible, because I'm a Grade 12 student with experience on Eclipse but not with Android Studio :P

Thanks so much, sorry if the questions are dumb! I'm a beginner and have searched the web but am unable to find answers to these questions I have.

Gdx.graphics.getWidth() and Gdx.graphics.getHeight() returns the width and height (in pixels) of the window (or on mobile, the screen) that your application is running in.

When dealing with different screens it is often necessary to decide for a certain strategy how those different screen sizes and aspect ratios should be handled. Camera and Stage support different viewport strategies.

LibGDX provides a more convenient way of dealing with this problem: Viewport


Take a look of this answer, why should you use Android Studio while developing LibGDX games.


You need some basic setup for android deployment, either you use gradle command on terminal of Andoid Studio or if follow these steps for deployment using eclipse.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM