public AfterGameScreen(Game game, AudioManager audioManager) { this.game = game; font = new BitmapFont(); skin = new Skin(); this.audioManager = audioManager; batch = new SpriteBatch(); background = new Texture(Gdx.files.internal("homescreen/deadscene.png")); background.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); sprite = new Sprite(background); backgroundRegion = new TextureRegion(background); buttonTexture = new Texture(Gdx.files.internal("buttons/backmenu.png")); buttonTexture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); buttonTextureRegion = new TextureRegion(buttonTexture); buttonTexturePlay = new Texture(Gdx.files.internal("buttons/playagain.png")); buttonTexturePlay.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear); buttonTextureRegionPlay = new TextureRegion(buttonTexturePlay); style = new TextButton.TextButtonStyle(); style.up = new TextureRegionDrawable(buttonTextureRegion); style.down = new TextureRegionDrawable(buttonTextureRegion); style.font = font; stylePlay = new TextButton.TextButtonStyle(); stylePlay.up = new TextureRegionDrawable(buttonTextureRegionPlay); stylePlay.down = new TextureRegionDrawable(buttonTextureRegionPlay); stylePlay.font = font; exitButton = new TextButton("", style); exitButton.setBounds(Gdx.graphics.getWidth() / 2 - 154, 30, 144, 96); playButton = new TextButton("", stylePlay); playButton.setBounds(Gdx.graphics.getWidth() / 2 + 10, 30, 144, 96); stage = new Stage(); Gdx.input.setInputProcessor(stage); stage.addActor(exitButton); stage.addActor(playButton); }
public SettingsScreen(AbstractScreen parentScreen) { super(parentScreen); initFitViewport(); // final AbstractAuthService authService = // mAdapter.getPlatformServices().getAuthService(); mBgStage.loadImage(this, "Bg/menu/settings-bg.jpg"); BackButton.create(this, MainMenuScreen.class); mSettings = new LocalSettings(); final CheckBox cbSounds = new CheckBox("", RM.getCheckBoxStyle()); cbSounds.setBounds(20, 500, SES.BUTTON_HEIGHT, SES.BUTTON_HEIGHT); cbSounds.setChecked(mSettings.getSoundEnabled()); mStage.addActor(cbSounds); cbSounds.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { mSettings.setSoundEnabled(cbSounds.isChecked()); mSettings.flush(); } }); Label lblSounds = new Label("Sound effects", RM.getLabelStyle()); lblSounds.setBounds(120, 500, 200, SES.BUTTON_HEIGHT); mStage.addActor(lblSounds); final CheckBox cbMusic = new CheckBox("", RM.getCheckBoxStyle()); cbMusic.setBounds(20, 400, SES.BUTTON_HEIGHT, SES.BUTTON_HEIGHT); cbMusic.setChecked(mSettings.getMusicEnabled()); mStage.addActor(cbMusic); cbMusic.addListener( new ClickListener() { public void clicked(InputEvent event, float x, float y) { mSettings.setMusicEnabled(cbMusic.isChecked()); mSettings.flush(); } }); Label lblMusic = new Label("Music", RM.getLabelStyle()); lblMusic.setBounds(120, 400, 200, SES.BUTTON_HEIGHT); mStage.addActor(lblMusic); TextButton btnGooglePlayLink = new TextButton("GooglePlay", RM.getTextButtonStyle()); btnGooglePlayLink.setBounds(SES.buttonRight(), 20, SES.BUTTON_WIDTH, SES.BUTTON_HEIGHT); mStage.addActor(btnGooglePlayLink); btnGooglePlayLink.addListener( new ClickListener() { public void clicked(InputEvent event, float x, float y) {} }); }
private void popButtons() { VerticalGroup listNoob = new VerticalGroup(); VerticalGroup listHardcore = new VerticalGroup(); VerticalGroup listOther = new VerticalGroup(); int y_init = Gdx.graphics.getHeight() - 100; int x_init = 70; int counter = 0; for (Constants.achiev_types type : Constants.achiev_types.values()) { AchievBtn btn = new AchievBtn(type.toString(), StylesManager.skin, type); btn.setBounds(x_init, y_init, 150, 35); y_init -= 40; list.add(btn); if (counter < 20) listNoob.addActor(btn); else if (counter < 40) listHardcore.addActor(btn); else listOther.addActor(btn); counter++; } // add back button final TextButton btn = new TextButton("Back", StylesManager.btnGray); btn.setBounds(Gdx.graphics.getWidth() / 2 - 75, 20, 150, 35); btn.addListener( new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { if (x < btn.getWidth() && x > 0 && y < btn.getHeight() && y > 0) maingame.setScreen(maingame.questsScreen); } }); table.addActor(btn); ScrollPane sp1 = new ScrollPane(listNoob, StylesManager.skin); ScrollPane sp2 = new ScrollPane(listHardcore, StylesManager.skin); ScrollPane sp3 = new ScrollPane(listOther, StylesManager.skin); setSP(sp1); sp1.setPosition(73, 92); table.addActor(sp1); setSP(sp2); sp2.setPosition(72 + 212, 92); table.addActor(sp2); setSP(sp3); sp3.setPosition(71 + 2 * 212, 92); table.addActor(sp3); }
private void loadHUD() { Skin skin = new Skin(); TextButtonStyle style = new TextButton.TextButtonStyle(); skin.add("default", new BitmapFont()); style.font = skin.getFont("default"); skin.add("default", style); TextButton button1 = new TextButton("HUD-Label1", skin); uiStage.addActor(button1); button1.setPosition(camera.viewportWidth / 2 - 100, 0); button1.setBounds(button1.getX(), button1.getY(), button1.getWidth(), button1.getHeight()); uiStage.addActor(new TextButton("HUD-Label2", skin)); }
private void popButtons() { // TODO Auto-generated method stub final TextButton btnOpt = new TextButton("Options", StylesManager.btnGray); final TextButton btnCloud = new TextButton("Cloud", StylesManager.btnGray); final TextButton btnPlay = new TextButton("Play", StylesManager.btnBlue); final TextButton btnSur = new TextButton("Survival", StylesManager.btnGreen); final TextButton btnCamp = new TextButton("Campaign", StylesManager.btnGreen); final Image imgCloud = new Image(Textures.cloud); imgCloud.setPosition(570, -140); // game modes btns btnSur.setBounds(250, 180, 150, 35); btnSur.addListener( new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { if (x < btnSur.getWidth() && x > 0 && y < btnSur.getHeight() && y > 0) { maingame.setScreen( maingame.questsScreen.generateScreen( maingame.constDump.Survival(maingame.constDump.Home()))); btnSur.addAction(Actions.fadeOut(1)); btnCamp.addAction(Actions.fadeOut(1)); btnPlay.setVisible(true); btnPlay.addAction(Actions.fadeIn(1)); } } }); btnSur.getColor().a = 0; table.addActor(btnSur); btnCamp.setBounds(410, 180, 150, 35); btnCamp.addListener( new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { if (x < btnCamp.getWidth() && x > 0 && y < btnCamp.getHeight() && y > 0) { maingame.setScreen(maingame.questsScreen); btnSur.addAction(Actions.fadeOut(1)); btnCamp.addAction(Actions.fadeOut(1)); btnPlay.setVisible(true); btnPlay.addAction(Actions.fadeIn(1)); } } }); btnCamp.getColor().a = 0; table.addActor(btnCamp); // other btns btnOpt.setBounds(330, 130, 150, 35); btnOpt.getColor().a = 0.8f; btnOpt.addListener( new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { if (x < btnOpt.getWidth() && x > 0 && y < btnOpt.getHeight() && y > 0) { btnSur.addAction(Actions.fadeOut(1)); btnCamp.addAction(Actions.fadeOut(1)); btnPlay.setVisible(true); btnPlay.addAction(Actions.fadeIn(1)); } } }); table.addActor(btnOpt); btnCloud.setBounds(650, 20, 90, 30); btnCloud.getColor().a = 0.7f; btnCloud.addListener( new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { if (x < btnCloud.getWidth() && x > 0 && y < btnCloud.getHeight() && y > 0) { btnSur.addAction(Actions.fadeOut(1)); btnCamp.addAction(Actions.fadeOut(1)); btnPlay.setVisible(true); btnPlay.addAction(Actions.fadeIn(1)); SequenceAction img_action = new SequenceAction(); img_action.addAction(Actions.moveTo(570, -40, 1, Interpolation.linear)); img_action.addAction(Actions.delay(0.2f)); img_action.addAction(Actions.moveTo(570, -140, 1, Interpolation.linear)); imgCloud.addAction(img_action); } } }); table.addActor(imgCloud); table.addActor(btnCloud); btnPlay.setBounds(155 * 2 + 20, 180, 150, 35); btnPlay.addListener( new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { if (x < btnPlay.getWidth() && x > 0 && y < btnPlay.getHeight() && y > 0) { btnSur.addAction(Actions.fadeIn(1)); btnCamp.addAction(Actions.fadeIn(1)); btnPlay.addAction(Actions.fadeOut(1)); btnPlay.setVisible(false); } } }); table.addActor(btnPlay); }