Python中文网

一个关于 编程问题的解答网站.

有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Libgdx Mtx纹理不会显示在屏幕上

我试图从mtx flame words example重新创建菜单,但屏幕上没有显示菜单中的任何内容。这些资产没有问题,因为我可以将它们与spritebatch一起使用。这个例子几乎是1:1,我不知道问题出在哪里

public class MainMenuScreen extends AbstractScreen implements IScreen{

private MainMenuScreenButtons mainMenuScreenButtons;
public MainMenuScreen(AbstractGame game, String screenName) {
    super(game, screenName);
    // TODO Auto-generated constructor stub
    setUpScreenElements();
    setUpMenu();
}

@Override
public void setUpScreenElements() {
    setOpenGLClearColor(0.1f, 0.1f, 0.1f, 1f);
    setBackgroundTexture(Assets.background);
}

@Override
public void setUpMenu() {
    // TODO Auto-generated method stub
    mainMenuScreenButtons = new MainMenuScreenButtons(MainMenuScreen.this);

}

public MainMenuScreenButtons getMainMenuScreenButtons() {
    return mainMenuScreenButtons;
}

@Override
public void render(float delta) {
    // TODO Auto-generated method stub
    super.render(delta);
}
}

主菜单屏幕按钮

public class MainMenuScreenButtons {
private MainMenuScreen mainMenuScreen;

private Table tableMain;
private Table tableButtons;

private ButtonLight btnPlay;

public MainMenuScreenButtons(MainMenuScreen mainMenuScreen) {
    // TODO Auto-generated constructor stub
    this.mainMenuScreen = mainMenuScreen;
    setUp();
}

public void setUp() {
    // TODO Auto-generated method stub
    tableMain = new Table();
    tableMain.setFillParent(true);
    tableButtons = new Table();


            btnPlay = new ButtonLight(310,130,Assets.buttons,true);

            UtilsOrigin.setActorOrigin(btnPlay, Origin.CENTER);

            tableButtons.add(btnPlay).row();
            tableButtons.center();
            tableMain.add(tableButtons).center();
            mainMenuScreen.getStage().addActor(tableMain);
}

}

共 (1) 个答案