Home Game Development LibGDX Button and Table Layout

LibGDX Button and Table Layout

0
LibGDX Button and Table Layout

[ad_1]

I want to change the position of the Buttons inside a table, I tried setting their X and Y, or get their position when adding the Buttons on the Table, but it didn’t work. It always aligns the button on the center.

Code:

    TextureAtlas ta = new TextureAtlas("Comecar.txt");
    final TextureAtlas.AtlasRegion as = ta.findRegion("comeca");
    final TextureAtlas.AtlasRegion as2 = ta.findRegion("comecaversao2");
    myTexRegionDrawable2 = new TextureRegionDrawable(as2);
    myTexRegionDrawable = new TextureRegionDrawable(as);
    myTexRegionDrawable.setMinHeight(300);
    myTexRegionDrawable.setMinWidth(260);
    myTexRegionDrawable2.setMinHeight(300);
    myTexRegionDrawable2.setMinWidth(260);
    b = new ImageButton(myTexRegionDrawable);
    op = new ImageButton(myTexRegionDrawable2);
    op.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
        }
    });
    b.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            gdxGame.setScreen(new Janela2(gdxGame));
        }
    });
    t = new Table();
    t.add(b);//I tried setting the position here
    t.add(op);
    t.setFillParent(true);
    stage.addActor(t);
    Gdx.input.setInputProcessor(stage);
}

[ad_2]

Previous article Puzzle Strike on Steam — Sirlin.Net — Game Design
Next article Can Chinchou be shiny in Pokémon Go?
Hello there! My name is YoleeTeam, and I am thrilled to welcome you to AmazonianGames.com. As the premier destination for all things related to Amazon Games' universe, we are dedicated to providing you with the most exciting and immersive gaming experiences out there. From captivating visuals to exhilarating gameplay, our website is packed with comprehensive insights, updates, and reviews to keep you ahead of the game. Whether you're a seasoned gamer or new to the scene, I am here to guide you through this virtual frontier. If you have any questions or suggestions, feel free to reach out to me at john@yoleesolutions.com. Embark on your Amazon gaming journey today with AmazonianGames.com and let the adventure begin!