コード例 #1
0
ファイル: StateHeader.cpp プロジェクト: neiderm/pandorapanic
void StateHeader::userInput()
{

    input->update();
    #ifdef PLATFORM_PC
        if(input->isQuit()) {
            nullifyState();
        }
    #endif

    if (input->isStart())
    {
        pauseToggle();
        input->resetKeys();
    }


    // User mashing the buttons?
    if ( statePL == 0  &&  input->isX())
		statePL	= 1;			// start jump up.
	if ( statePR == 0  &&  input->isB())
		statePR	= 1;			// start jump up right sprite.

	//sndKick.setGlobalVolume(50);
	if ( input->isA())
		sndKick.play();
}
コード例 #2
0
void StateDarkTreasure::userInput()
{
    input->update();
    #ifdef PLATFORM_PC
        if(input->isQuit())
            nullifyState();
    #endif

    m_Engine->userInput(input);
}
コード例 #3
0
void StateOneButtonBandit::userInput() {
    input->update();
    #ifdef PLATFORM_PC
        if(input->isQuit()) {
            nullifyState();
        }
    #endif
    // The pausecheck
    if (input->isStart())
    {
            pauseToggle();
            input->resetKeys();
    }

    // Only check for user input when the game has become playable
    if (currentState == 3) {
        if (waitForButtonLift) {
            if (!input->isB()) {
                waitForButtonLift = false;
            }
        }
        else if (input->isB()) {
            waitForButtonLift = true;
            // Set the left column to stop mode
            // Advance to the next column
            if (currentColumn == 0 && leftColumn.isValid()) {
                leftColumn.stopOnMatch();
                currentColumn = 1;
                centreColumn.active = true;
            }
            else if (currentColumn == 1 && centreColumn.isValid()) {
                centreColumn.stopOnMatch();
                currentColumn = 2;
                rightColumn.active = true;
            }
            else if (currentColumn == 2 && rightColumn.isValid()) {
                win = true;
                rightColumn.stopOnMatch();
                currentState = 4;
            }
            else {
                // Play the buzz

                // Go straight to endgame mode
                switch (currentColumn) {
                    case 0: leftColumn.instantStop(); break;
                    case 1: centreColumn.instantStop(); break;
                    case 2: rightColumn.instantStop(); break;
                }
                win = false;
                currentState = 4;
            }
        }
    }
}
コード例 #4
0
ファイル: StateStory.cpp プロジェクト: x1212/RainyDay
void StateStory::userInput()
{
    input->update();
    if(input->isQuit() || input->isSelect())
        nullifyState();

    if(EFFECTSYSTEM->getFadeAlpha() == 0 && (input->isStart() || input->isA() || input->isB() || input->isX() || input->isY()))
    {
        m_IsEnd = true;
        EFFECTSYSTEM->fadeOut(8);
    }
}
コード例 #5
0
ファイル: StateTitle.cpp プロジェクト: x1212/RainyDay
void StateTitle::userInput()
{
    input->update();
    if(input->isQuit() || input->isSelect())
        nullifyState();

    if(EFFECTSYSTEM->getFadeAlpha() == 0 && m_CurrentScreen == 2 && input->isStart())
    {
        m_IsEnd = true;

        EFFECTSYSTEM->fadeOut(4);

        SOUNDSYSTEM->playSound(THUNDER4);
    }
}
コード例 #6
0
void StateBadVista::userInput()
{
  if (inputDelay.getTicks() < INPUT_DELAY)
    return;
  inputDelay.start();

  input->update();
  #ifdef PLATFORM_PC
    if(input->isQuit())
      nullifyState();
  #endif

  if(input->isB() && bvState < BV_PITCHED) {
    bvState = BV_WINDUP;
    armAngle += armIncrement;
    if (armAngle >= ARM_ANGLE_MAX || armAngle <= 1) {
      armIncrement = -armIncrement;
      ++pwned_count;
      pwned =  PWNED_STOPPED <= pwned_count && pwned_count <= PWNED_PWNED + 1;

    }

    logo.setPosition((int)ARM_INIT_X, (int)ARM_INIT_Y + armAngle);
  }

  if (bvState == BV_WINDUP && !input->isB()) {
    bvState = BV_PITCHED;

    logoX = LOGO_INIT_X;
    logoY = LOGO_INIT_Y;
    float initVelocity = (float) armAngle * ANGLE_TO_VELOCITY_MULTIPLIER;
    logoVelocityX = -initVelocity;
    logoVelocityY = initVelocity;
    armAngle = 1;
  }

  if(bvState > BV_PITCHED) {
    if(input->isB())
      setNextState(STATE_MAIN);
  }

  if(input->isStart())//I wasnt sure what exit key was...
    {
        pauseToggle();
        input->resetKeys();
    }
}
コード例 #7
0
ファイル: StateCredits.cpp プロジェクト: neiderm/pandorapanic
void StateCredits::userInput()
{
	//	Refresh inputs
	input->update();
    #ifdef PLATFORM_PC
        if(input->isQuit())
            nullifyState();
    #endif
	//	Skip current Credits item
	if((input->isB() || input->isX()) && currentLine < NumberUtility::getSize(CREDITS)-1)
	{
		++currentLine;
		input->resetKeys();
	}
	//	skip credits
	if(input->isStart())
	{
		setNextState(STATE_TITLE);
		input->resetKeys();
	}
}
コード例 #8
0
void StateBarrelRoll::userInput()
{

    input->update();
    #ifdef PLATFORM_PC
        if(input->isQuit())
            nullifyState();
    #endif

    if(input->isLeft())
    {
        ang += 0.3;
        //Input.resetKeys();
    }
    if(input->isRight())
    {
        ang -= 0.3;
        //Input.resetKeys();
    }

    if(input->isUp())
    {
       zoom += 0.001;
    }

    if(input->isDown())
    {
        if(zoom > 0.3)
        {
            zoom -= 0.001;
        }
    }

    if(input->isSelect())//I wasnt sure what exit key was...
    {
        setNextState(STATE_MAIN);
        //nullifyState();
        input->resetKeys();
    }
}
コード例 #9
0
void StateDistractedMath::userInput()
{

    if (mathstate == 0)
    {
        SDL_Event event;
        while(SDL_PollEvent(&event))
        {
            switch(event.type)
            {
                #ifdef PLATFORM_PC
                    case SDL_QUIT: nullifyState(); break;
                    case SDL_KEYDOWN:
                        if(event.key.keysym.sym == SDLK_RETURN) {
                            pauseToggle();
                            break;
                        }
                #elif PLATFORM_PANDORA
                    case SDL_KEYDOWN:
                        if(event.key.keysym.sym == SDLK_LALT) {
                            pauseToggle();
                            break;
                        }
                #endif

                    MathInputUnicode =  (event.key.keysym.sym); // unicode input
                    #ifdef PENJIN_FIXED
                        MathInputNumeric = MathInputUnicode.intValue<<16 - 48; // numeric is 48 ascii chars lower :)
                    #else
                        MathInputNumeric = MathInputUnicode - 48; // numeric is 48 ascii chars lower :)
                    #endif
                    if (MathInputNumeric == number)  // if entered number matches correct answer
                    {
                        round = round + 1;
                        if (level < 25)
                        {
                            difficulty = 0;
                            if (round == 6)    //  Adjust the value after round to adjust game difficulty. more rounds more difficult.
                                hasWon = true;
                            if (oper == 0)      // oper is used to switch calculations
                                oper = oper + 1;
                            else
                                oper = oper - 1;
                        }
                        else if (level < 50)
                        {
                            difficulty = 1;
                            if (round == 7)    //  Adjust the value after round to adjust game difficulty. more rounds more difficult.
                                hasWon = true;
                            if (oper == 0)      // oper is used to switch calculations
                                oper = oper + 1;
                            else
                                oper = oper - 1;
                        }
                        else
                        {
                            difficulty = 2;
                            if (round == 8)    //  Adjust the value after round to adjust game difficulty. more rounds more difficult.
                                hasWon = true;
                            if (oper == 0)      // oper is used to switch calculations
                                oper = oper + 1;
                            else
                                oper = oper - 1;
                        }
                        teller.start();     //restart counter

                        MathInputNumeric = -1;  // reset input

                        number = rand()%10; // generate random again
                        if (oper == 0)
                        {
                            number2 = rand()%(10 + level);           //
                            number3 = number2 - number;    // the calculations
                        }                                  //
                        if (oper == 1)                     //
                        {                                  //
                            number2 = (rand()%(int)((3 + level)*0.5f)) + 1;           //
                            number3 = number2 * number;    //
                        }
                        rnd = rand()%4;     // background switch

                    }
                    else            // if input is incorrect
                    {
                        if (MathInputNumeric >= 10 && MathInputUnicode != 13)   // Generally this should include most
                        {                           // of the pandora's input outside the numbers. not sure
                            teller.start();         // about the buttons though

                            round = 6;
                            mathstate = 1;
                        }
                        else                        // or wrong number
                        {
                            if (MathInputUnicode != 13)
                            {
                            teller.start();
                            losestate = round;      // keep for the loser  message but round is used in closing
                            round = 6;
                            mathstate = 2;
                            }
                        }
                    }
            }
        }
    }
}