Beispiel #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;
    }
}
Beispiel #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;
    }
}
Beispiel #3
0
void hidTestApp::keyDown( cinder::app::KeyEvent event )
{
	if( event.getChar() == ' ' ) {
		mInteractionZones->captureBarrier();
		mInteractionZonesDebug->enableZone();
	}
	if( event.getChar() == 'w' ) {
		mInteractionZones->writeInteractionZone();
	}
	
	if( event.getChar() == 'd' ) {
		mInteractionZonesDebug->enableDistance( ! mInteractionZonesDebug->isDistanceEnabled() );
	}
	
	if( event.getChar() == 'z' ) {
		mInteractionZonesDebug->enableZone( ! mInteractionZonesDebug->isZoneEnabled() );
	}
	
	if( event.getChar() == 'q' ) {
		mInteractionZones->queryIgnoreIndices();
	}
	
	if( event.getChar() == 'p' ) {
		std::cout << "Printing ignore indices: ";
		auto ignoreIndices = mInteractionZones->getIgnoreIndices();
		int last = 0;
		for( auto & indice : ignoreIndices ) {
			if( last == 0 ) {
				last = indice;
			}
			if( last != indice-1 ) {
				cout << endl << "  New Ignore Zone: ";
			}
			cout << indice << ", ";
			last = indice;
		}
		std::cout << std::endl;
	}
}
Beispiel #4
0
//----------------------------------------------------------------------------------------------------------------------
void SMCAgentViz::onKeyPress(cinder::app::KeyEvent e)
{
  if(e.getCode() == ci::app::KeyEvent::KEY_SPACE)
    m_paused = !m_paused;
};