Ejemplo n.º 1
0
void PauseMenuMode::Update(float timeElapsed) {
   if (mResume.IsPressed())
      mNextMode = mWorldMode;
   if (mClick.IsPressed()) {
      InputManager *im = mGameWindow->GetInputManager();

      int mouseX = im->GetMouseX();
      int mouseY = im->GetMouseY();

      mButtonPressed = -1;
      for (int i = 0; i < NUM_PAUSE_BUTTONS; ++i) {
         if (mButtons[i].IsIn(mouseX, mouseY)) {
            mButtonPressed = i;
         }
      }
   }
   else {
      if (mButtonPressed == BTN_RESUME) {
         mNextMode = mWorldMode;
      }
      else if (mButtonPressed == BTN_OPTIONS) {
         // TODO: add options menu
      }
      else if (mButtonPressed == BTN_QUIT) {
         mNextMode = mMainMenuMode;
      }
      mButtonPressed = -1;
   }
}
void CharacterSelectMode::Update(float timeElapsed) {
	if (mClick.IsPressed()) {
		InputManager *im = mGameWindow->GetInputManager();

		int mouseX = im->GetMouseX();
		int mouseY = im->GetMouseY();

		mButtonPressed = -1;
		for (int i = 0; i < NUM_SELECT_BUTTONS; ++i) {
			if (mButtons[i].IsIn(mouseX, mouseY)) {
				mButtonPressed = i;
			}
		}
	}
	else {
		if (mButtonPressed == BTN_PREVIOUS) {
			mCharacterNdx = mCharacterNdx - 1 < 0 ? NUM_CHARACTERS - 1 : 
				mCharacterNdx - 1;
		}
		else if (mButtonPressed == BTN_BACK) {
			mNextMode = mMainMenuMode;
		}
		else if (mButtonPressed == BTN_OK) {
			mWorldMode->Reset();
			mWorldMode->SetPlayerNdx(mCharacterNdx);
			mNextMode = mWorldMode;
		}
		else if (mButtonPressed == BTN_NEXT) {
			mCharacterNdx = mCharacterNdx + 1 > NUM_CHARACTERS - 1 ? 0 : 
				mCharacterNdx + 1;
		}
		mButtonPressed = -1;
	}

	mRotation += 90.0f * timeElapsed;
}