コード例 #1
0
 private void handleInput() {
   if (Gdx.input.isButtonPressed(Buttons.LEFT)) {
     if (isSelected) {
       SoundManager.getInstance().playSound(SoundManager.getInstance().mSoundSelectMenu);
       switch (menuIndex) {
         case 0:
           // Easy
           GameUtils.getInstance().levelIndex = 0;
           goToGame();
           break;
         case 1:
           // Normal
           GameUtils.getInstance().levelIndex = 1;
           goToGame();
           break;
         case 2:
           // Hard
           GameUtils.getInstance().levelIndex = 2;
           goToGame();
           break;
         case 3:
           // Back
           this.mGame.setScreen(new MainMenuScreen(mGame));
           break;
         default:
           break;
       }
     }
   }
 }
コード例 #2
0
  public SettingScreen(MyMainGame game) {
    // TODO Auto-generated constructor stub
    this.mGame = game;
    mBatch = new SpriteBatch();
    String music = "";
    String sound = "";
    isSelected = false;
    GameUtils.setInputProcessor(mInput);
    if (GameUtils.getInstance().music) {
      music = "Music: ON";
    } else {
      music = "Music: OFF";
    }

    if (GameUtils.getInstance().sound) {
      sound = "Sound: ON";
    } else {
      sound = "Sound: OFF";
    }
    Gdx.graphics.setContinuousRendering(false);
    Gdx.graphics.requestRendering();
    background = TextureManager.getInstance().textureBackgroundOutGame;
    selector = TextureManager.getInstance().textureMainMenuSelector;
    txtTitle = new TextWrapper("Settings", new Vector2(120, 520));
    txtMusic = new TextWrapper(music, new Vector2(150, 450));
    txtSound = new TextWrapper(sound, new Vector2(150, 400));
    txtBack = new TextWrapper("Back", new Vector2(150, 350));
    selector_Y = (int) txtMusic.position.y - 35;
  }
コード例 #3
0
  @Override
  public void render(float delta) {
    // TODO Auto-generated method stub
    GameUtils.clearScreen();
    mBatch.begin();
    mBatch.draw(background, 0, 0);
    txtTitle.Draw(mBatch, GameUtils.getInstance().systemFont, Color.WHITE);
    txtMusic.Draw(mBatch, GameUtils.getInstance().systemFont, Color.WHITE);
    txtSound.Draw(mBatch, GameUtils.getInstance().systemFont, Color.WHITE);
    txtBack.Draw(mBatch, GameUtils.getInstance().systemFont, Color.WHITE);
    mBatch.draw(selector, 25, selector_Y);
    mBatch.end();

    handleInput();
  }
コード例 #4
0
 private void handleInput() {
   if (Gdx.input.isButtonPressed(Buttons.LEFT)) {
     if (isSelected) {
       switch (menuIndex) {
         case 0:
           // Sound
           if (GameUtils.getInstance().music) {
             GameUtils.getInstance().music = false;
             txtMusic.content = "Music: OFF";
           } else {
             GameUtils.getInstance().music = true;
             txtMusic.content = "Music: ON";
           }
           break;
         case 1:
           // Music
           if (GameUtils.getInstance().sound) {
             GameUtils.getInstance().sound = false;
             txtSound.content = "Sound: OFF";
           } else {
             GameUtils.getInstance().sound = true;
             txtSound.content = "Sound: ON";
           }
           break;
         case 2:
           this.mGame.setScreen(new MainMenuScreen(mGame));
           break;
         default:
           break;
       }
     }
   }
 }
コード例 #5
0
 public ChooseLevel(MyMainGame game) {
   this.mGame = game;
   isSelected = false;
   mSpriteBatch = new SpriteBatch();
   Gdx.graphics.setContinuousRendering(false);
   Gdx.graphics.requestRendering();
   GameUtils.setInputProcessor(mInputP);
   mTextureBackground = TextureManager.getInstance().textureBackgroundOutGame;
   mTextureSelector = TextureManager.getInstance().textureMainMenuSelector;
   mTxtChooseTitle = new TextWrapper("Choose level", new Vector2(120, 520));
   mTxtEasy = new TextWrapper("Easy", new Vector2(150, 450));
   mTxtNormal = new TextWrapper("Normal", new Vector2(150, 400));
   mTxtHard = new TextWrapper("Hard", new Vector2(150, 350));
   mTxtExit = new TextWrapper("Back", new Vector2(150, 300));
   selector_Y = (int) mTxtEasy.position.y - 35;
 }
コード例 #6
0
  @Override
  public void render(float delta) {
    // TODO Auto-generated method stub
    GameUtils.clearScreen();
    mSpriteBatch.begin();
    mSpriteBatch.draw(mTextureBackground, 0, 0);
    mTxtChooseTitle.Draw(mSpriteBatch, GameUtils.getInstance().systemFont, Color.WHITE);
    mTxtEasy.Draw(mSpriteBatch, GameUtils.getInstance().systemFont, Color.WHITE);
    mTxtNormal.Draw(mSpriteBatch, GameUtils.getInstance().systemFont, Color.WHITE);
    mTxtHard.Draw(mSpriteBatch, GameUtils.getInstance().systemFont, Color.WHITE);
    mTxtExit.Draw(mSpriteBatch, GameUtils.getInstance().systemFont, Color.WHITE);
    mSpriteBatch.draw(mTextureSelector, 25, selector_Y);
    mSpriteBatch.end();

    handleInput();
  }