Não estou conseguindo adicionar atores(Actor) em uma Screen.Eu quero mostrar um ator no "ScreenMenu" e nada acontece (o ator não aparece), segue me código:
MainClass.java
public class MainClass extends Game{
public static Stage stage;
private OrthographicCamera gameCam;
private Viewport gamePort;
public static int V_WIDTH = 0;
public static int V_HEIGHT =0;
public SpriteBatch batch;
@Override
public void create() {
V_WIDTH = Gdx.graphics.getWidth();
V_HEIGHT = Gdx.graphics.getHeight();
gameCam = new OrthographicCamera();
gamePort = new FitViewport(V_WIDTH,V_HEIGHT, gameCam);
batch = new SpriteBatch();
stage = new Stage();
setScreen(new ScreenMenu(this));
}
@Override
public void dispose() {
super.dispose();
}
@Override
public void render() {
super.render();
Gdx.gl.glClearColor(color.r, color.g, color.b, color.a);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.draw();
}
ScreenMenu.java
public class ScreenMenu implements Screen {
public static Stage stage;
private Viewport viewport;
public SpriteBatch batch;
BotaoTrovaoActor btn;
private MainClass mainClass;
public ScreenMenu(MainClass mc)
{
mainClass=mc;
}
@Override
public void show() {
stage = new Stage();
batch = new SpriteBatch();
btn = new BotaoTrovaoActor();
btn.setBounds(100,400 , 72, 72);
stage.addActor(btn);
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
stage.draw();
}
@Override
public void resize(int width, int height) {
}
@Override
public void pause() {
}
@Override
public void resume() {
}
@Override
public void hide() {
}
@Override
public void dispose() {
}
}