コード例 #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
        @Override
        public boolean mouseMoved(int screenX, int screenY) {
          // TODO Auto-generated method stub
          isSelected = false;
          // Easy
          if (screenX > 65 && screenX < 200 && screenY > 160 && screenY < 190) {
            SoundManager.getInstance().playSound(SoundManager.getInstance().mSoundSwitchMenu);
            menuIndex = 0;
            selector_Y = 600 - 185;
            isSelected = true;
          }

          // Normal
          if (screenX > 65 && screenX < 200 && screenY > 210 && screenY < 240) {
            selector_Y = 600 - 235;
            menuIndex = 1;
            isSelected = true;
            SoundManager.getInstance().playSound(SoundManager.getInstance().mSoundSwitchMenu);
          }

          // Hard

          if (screenX > 65 && screenX < 200 && screenY > 260 && screenY < 290) {
            selector_Y = 600 - 285;
            menuIndex = 2;
            isSelected = true;
            SoundManager.getInstance().playSound(SoundManager.getInstance().mSoundSwitchMenu);
          }
          // Back

          if (screenX > 65 && screenX < 200 && screenY > 310 && screenY < 340) {
            selector_Y = 600 - 335;
            menuIndex = 3;
            isSelected = true;
            SoundManager.getInstance().playSound(SoundManager.getInstance().mSoundSwitchMenu);
          }
          return false;
        }