コード例 #1
0
ファイル: GSettings.java プロジェクト: Nerogar/TileSurvival
 @Override
 public void update() {
   super.update();
   textMusic2.setText(sliderMusic.getText());
   textEffects2.setText(sliderEffects.getText());
   SoundCategory.MUSIC.setGain(sliderMusic.getPosition());
   SoundCategory.EFFECT.setGain(sliderEffects.getPosition());
 }
コード例 #2
0
ファイル: GSettings.java プロジェクト: Nerogar/TileSurvival
  public GSettings() {
    super(true);

    // float width = 4f;
    // System.out.println((Map.TILE_RENDER_SIZE / Map.TILE_PIXEL_COUNT));
    // float posX = ((Game.game.WIDTH - (width / 2f) * (Map.TILE_RENDER_SIZE / Map.TILE_PIXEL_COUNT)
    // * Map.TILE_RENDER_SIZE) / 2) / (Map.TILE_RENDER_SIZE);

    float posX = (Game.game.WIDTH - Map.TILE_RENDER_SIZE * 4f) * 0.5f;

    sliderMusic =
        new GESlider(
            new Vector(posX, 200),
            new Vector(Map.TILE_RENDER_SIZE * 4, Map.TILE_RENDER_SIZE),
            "a",
            0,
            1,
            SoundCategory.MUSIC.getGain());
    sliderEffects =
        new GESlider(
            new Vector(posX, 300),
            new Vector(Map.TILE_RENDER_SIZE * 4, Map.TILE_RENDER_SIZE),
            "a",
            0,
            1,
            SoundCategory.EFFECT.getGain());

    textMusic1 =
        new GEText(
            new Vector(posX - Map.TILE_RENDER_SIZE * 4, 200),
            new Vector(Map.TILE_RENDER_SIZE * 2, Map.TILE_RENDER_SIZE),
            "Music");
    textEffects1 =
        new GEText(
            new Vector(posX - Map.TILE_RENDER_SIZE * 4, 300),
            new Vector(Map.TILE_RENDER_SIZE * 2, Map.TILE_RENDER_SIZE),
            "Effects");

    textMusic2 =
        new GEText(
            new Vector(posX + Map.TILE_RENDER_SIZE * 4, 200),
            new Vector(Map.TILE_RENDER_SIZE * 2, Map.TILE_RENDER_SIZE),
            sliderMusic.getText());
    textEffects2 =
        new GEText(
            new Vector(posX + Map.TILE_RENDER_SIZE * 4, 300),
            new Vector(Map.TILE_RENDER_SIZE * 2, Map.TILE_RENDER_SIZE),
            sliderEffects.getText());

    buttonOk =
        new GEButton(
            new Vector(posX, 400),
            new Vector(Map.TILE_RENDER_SIZE * 4, Map.TILE_RENDER_SIZE),
            "OK");

    addGuiElements(
        buttonOk, sliderMusic, sliderEffects, textMusic1, textMusic2, textEffects1, textEffects2);
  }