Пример #1
0
void GameController::keyUp(cinder::app::KeyEvent event) {
    if( event.getCode() == KeyEvent::KEY_UP ) {
        activePlayer->dir.y = 0;
//        cout<<"up off"<<endl;
    }
    if( event.getCode() == KeyEvent::KEY_DOWN ) {
        activePlayer->dir.w = 0;
    }
    if( event.getCode() == KeyEvent::KEY_RIGHT ) {
        activePlayer->dir.x = 0;
//        cout<<"right off"<<endl;
    }
    if( event.getCode() == KeyEvent::KEY_LEFT ) {
        activePlayer->dir.z = 0;
    }
}
Пример #2
0
void GameController::keyDown(cinder::app::KeyEvent event) {
    //movement
    if( event.getCode() == cinder::app::KeyEvent::KEY_UP ) {
        activePlayer->dir.y = 1;
//        cout<<"up on"<<endl;
    }
    if( event.getCode() == cinder::app::KeyEvent::KEY_DOWN ) {
        activePlayer->dir.w = 1;
    }
    if( event.getCode() == cinder::app::KeyEvent::KEY_RIGHT ) {
        activePlayer->dir.x = 1;
//        cout<<"right on"<<endl;
    }
    if( event.getCode() == cinder::app::KeyEvent::KEY_LEFT ) {
        activePlayer->dir.z = 1;
    }
    
    //switch player
    if( event.getCode() == cinder::app::KeyEvent::KEY_TAB ) {
        cout<<"tab pressed"<<endl;
        switchPlayer();
    }
    
    //release ball
    if(event.getCode() == cinder::app::KeyEvent::KEY_SPACE) {
        cout<<"space pressed"<<endl;
        activePlayer->releaseBall();
        ball->speed = ball->maxSpeed;
    }
}
Пример #3
0
//----------------------------------------------------------------------------------------------------------------------
void SMCAgentViz::onKeyPress(cinder::app::KeyEvent e)
{
  if(e.getCode() == ci::app::KeyEvent::KEY_SPACE)
    m_paused = !m_paused;
};