I made a new class that implements Screen, what I've seen from other people's code is that they create a constructor that takes a parameter of Game game. I did not created a constructor, I think that's the reason why I get the error

  public class MainMenu implements Screen{
     public MainMenu(Game game){ //I dont know what are these for
            this.game = game;    //<--

 public void show() {
        btnAtlas=new TextureAtlas(Gdx.files.internal("bitters.atlas"));
        skin=new Skin();
        stage=new Stage(Gdx.graphics.getWidth(),Gdx.graphics.getHeight(),true);// I get the error here when initializing the Stage

the error is "Cannon resolve constructor 'Stage(int,int,boolean)'"


The message is pretty clear. There is no constructor that takes (int, int, boolean). Here are the constructors from Stage.java source code.


  • \$\begingroup\$ So I need to create a new class for the stage? and use one of these constructors \$\endgroup\$ – masterYao09 Sep 9 '15 at 13:13
  • \$\begingroup\$ @masterYao09 Either edit the libgdx source code or create a Stage class that extends com.badlogic.gdx.scenes.scene2d.Stage and add a constructor that does what you need. But I am pretty sure that the libgdx constructor is enough to work with. \$\endgroup\$ – dimitris93 Sep 9 '15 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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