コード例 #1
0
  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) {}
        });
  }
コード例 #2
0
 @Override
 public void draw(float delta) {
   mBgStage.draw();
   mStage.getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
   mStage.draw();
 }