projet-programmation-orient.../core/src/sagittarius/view/CreditScreen.java

63 lines
1.7 KiB
Java
Raw Normal View History

package sagittarius.view;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.utils.ActorGestureListener;
import com.kotcrab.vis.ui.VisUI;
import com.kotcrab.vis.ui.widget.VisTable;
2021-05-14 12:58:14 +00:00
import com.badlogic.gdx.audio.Sound;
import sagittarius.view.ButtonSounded.*;
import sagittarius.SagittariusGame;
public class CreditScreen extends BaseScreen {
@Override
public void initialize() {
// A music is played
if (!SagittariusGame.disableMusic){
SagittariusGame.music.stop();
SagittariusGame.music = Gdx.audio.newMusic(Gdx.files.internal("core/assets/sounds/music/credit_music.mp3"));
SagittariusGame.music.setLooping(true);
2021-05-14 13:15:02 +00:00
SagittariusGame.music.setVolume(SagittariusGame.musicVolume);
SagittariusGame.music.play();
}
Gdx.input.setInputProcessor(uiStage);
// Table creation
VisTable table = new VisTable(true);
table.setFillParent(true);
uiStage.addActor(table);
// go back button
2021-05-14 12:58:14 +00:00
ButtonTextSounded returnButton = new ButtonTextSounded("Go Back");
returnButton.addListener(new ActorGestureListener() {
@Override
public void tap(InputEvent event, float x, float y, int count, int button) {
super.tap(event, x, y, count, button);
SagittariusGame.setActiveScreen( new StartScreen() );
}
});
table.add(returnButton).width(150);
table.row();
}
@Override
public void update(float dt) {
// nothing (?)
}
@Override
public void dispose() {
VisUI.dispose();
super.dispose();
}
}