1

I am trying to change my screen once the button is pressed, which is working pretty well on my PC, there is no delay, and once the button is pressed, the scene instantly changes and presents the new one, however, when i tried to work my app on my android devices (LG G2X & Galxy S 3) I faced the following issue;

After pressing the button, there is a slight delay of about 1-2 seconds and only then it changes to my called screen.

I am disposing all of the resources in the dispose method, and I am also calling the dispose method from my hide function since i don't want to hold extra screens in the background and waste memory.

here is my button:

private TextButton bPlay;

@Override
public void show() {
....

bPlay = new TextButton("PLAY", skin);
        bPlay.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                ((Game) Gdx.app.getApplicationListener())
                        .setScreen(new DifficultySelectorScreen());

            }
        });
        bPlay.pad(15);

....
}

I add it to my table, and then to the stage, and once its clicked, it moves me to select the difficulty for the game.

now its not only this button that has a delay on it, but every button i try to use.

4

1 回答 1

1

最终我发现了问题所在......每次屏幕更改时,它都会重新加载相同的内容skinatlas所以我制作了一个 AssetManager 来处理这个问题,我让它加载主菜单所需的资产,同时它呈现启动画面屏幕,以及游戏本身,同时在类似于启动屏幕的过渡页面中处理菜单资产和加载游戏资产。

于 2013-07-30T05:17:53.863 回答