LibGDX - implements ApplicationListener or Extends Game?

Hey guys, i’m rewriting my brickbreaker game to clean up code a bit, add a few things, etc. I’ve found a couple of tutorials for making screens, but i’m a bit confused about one thing in particular. I have my main class which is Game.java. In Game.java the class Implements ApplicationListener. I know I need to implement the application listener, but all of the tutorials are telling me, it should extend Game instead.


public class Game implements ApplicationListener {

I made another class thinking that, that should be my main class and it should extend game…But it doesnt seem right. I’m not sure I explained it correctly…Let me know if you understand what i’m saying.

I have a main class that extends libgdx’s Game class. This class will switch my screen(s).

Game is an abstract class that implements ApplicationListener, so you do not have to implement ApplicationListener yourself.

So, in my main Game.java class it should be:

public Game extends Game

instead of

public Game implements ApplicationListener
?

I used the GUI setup tool to create the project and the latter was used, (implements ApplicationListener.)

So basically, if I make (my)Game extend Game, it will implement ApplicationListener as well, correct?

Right, and to prevent ambiguity change your class’s name, like Main or else.

Pretty much, but it implements ApplicationListener itself. Game is basically just a Helper class to be used with the Screen interface. This is an easy way to set up multiple screens, like a menu screen, a options screen, the actual gameplay screen, etc.

Exact implementation is here.

extends ApplicationAdapter.

we do: implements ApplicationListener

Differences, benefits ?

It implements all the methods so you only have to implement the ones you care about. No difference other than that.

100% made to make your code cleaner ;D override needed only.