use of com.ilargia.games.entitas.egdx.api.ChangeStateCommand in project Entitas-Java by Rubentxu.
the class DelaySystem method execute.
@Override
public void execute(float deltatime) {
for (CoreEntity e : _group.getEntities()) {
Delay delay = e.getDelay();
delay.time += deltatime;
if (delay.time > delay.duration) {
PongGame.ebus.post((ChangeStateCommand<PongGame>) (nameState, game) -> game.changeState(game.getPongState(), game.getSlideTransition()));
delay.time = 0;
}
}
}
use of com.ilargia.games.entitas.egdx.api.ChangeStateCommand in project Entitas-Java by Rubentxu.
the class MenuState method init.
@Override
public void init() {
Gdx.app.log("Menu", "Init");
int pad = (int) (20 * SMGUIManager.ScaleUtil.getSizeRatio());
int pad2 = (int) (60 * SMGUIManager.ScaleUtil.getSizeRatio());
final TextButton btnStart = new TextButton("Comenzar", skin);
btnStart.pad(pad, pad2, pad, pad2);
final TextButton btnOptions = new TextButton("Opciones", skin);
btnOptions.pad(pad, pad2, pad, pad2);
final TextButton btnScores = new TextButton("Puntuaciones", skin);
btnScores.pad(pad, pad2, pad, pad2);
final TextButton button3 = new TextButton("Creditos", skin);
button3.pad(pad, pad2, pad, pad2);
button3.setChecked(false);
btnStart.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
System.out.println("Click Comenzar...");
}
});
btnOptions.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
System.out.println("Click optionScreen...");
SMGame.ebus.post((ChangeStateCommand<SMGame>) (nameState, game) -> game.changeState(game.getOptionState(), game.getFadeTransition()));
}
});
btnScores.addListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
System.out.println("Click highScoreScreen...");
SMGame.ebus.post((ChangeStateCommand<SMGame>) (nameState, game) -> game.changeState(game.getScoresState(), game.getSlideTransition()));
}
});
Label label = new Label("SUPER MARIANO", skin, "header", Color.CYAN);
label.setAlignment(Align.center, Align.center);
mainTable.defaults().padBottom(pad);
if (Gdx.graphics.getHeight() < 480)
mainTable.defaults().height(Gdx.graphics.getHeight() / 5f - pad);
mainTable.add(label);
mainTable.row();
mainTable.add(btnStart);
mainTable.row();
mainTable.add(btnOptions);
mainTable.row();
mainTable.add(btnScores);
mainTable.row();
mainTable.add(button3);
mainTable.row();
mainTable.setBackground(new SpriteDrawable(new Sprite((Texture) assetsManager.getTexture(SMGUIManager.MENU_BACKGROUND))));
mainTable.row();
}
Aggregations