void AnotherSandboxProjectApp::keyDown( KeyEvent event )
{
    switch (event.getCode())
    {
        case KeyEvent::KEY_SPACE:
            _DSPController->pause();
            break;
            
        case KeyEvent::KEY_c:
            _clearField();
            break;
            
        case KeyEvent::KEY_r:
            _randomField();
            break;
            
        case KeyEvent::KEY_q:
            _randomAll();
            break;
            
        case KeyEvent::KEY_s:
        {
            _clearField();
            ivec2 gridSize = _DSPController->getGridSize();
            ivec2 center = gridSize / 2;
            int centerIndex = center.x * gridSize.y + center.y;
            _DSPController->DefferedUpdateGrid[centerIndex].s[0] = (DSPSampleType)1.0;
            _DSPController->DefferedUpdateGrid[centerIndex - 1].s[0] = (DSPSampleType)1.0;
            _DSPController->DefferedUpdateGrid[centerIndex - 1 * gridSize.y].s[0] = (DSPSampleType)1.0;
            _DSPController->DefferedUpdateGrid[centerIndex - 2 * gridSize.y].s[0] = (DSPSampleType)1.0;
        }
            break;
            
        case KeyEvent::KEY_l:
            break;
            
        case KeyEvent::KEY_b:
            if (_params.isVisible())
                _params.hide();
            else
                _params.show();
            break;
    }
}
void KinectEcard::keyDown( KeyEvent event )
{
	if( event.getChar() == 'f' )
		setFullScreen( ! isFullScreen() );
	else if ( event.getChar() == KeyEvent::KEY_SPACE ){
		snapshot();
	}
	else if( event.getChar() == KeyEvent::KEY_p ) {
		if( mParams.isVisible() )
			mParams.hide();
		else
			mParams.show();
	}else if( event.getChar() == KeyEvent::KEY_SPACE ){
		snapshot();
	}else if( event.getChar() == KeyEvent::KEY_ESCAPE ){
		shutdown();
	}else if( event.getChar() == KeyEvent::KEY_c ){
		clear();
	}
}
Example #3
0
	void keyDown(KeyEvent event)
	{
		if (mEditMode == EditMode_RECORD) return;

		if (event.getCode() == KeyEvent::KEY_ESCAPE) {
			delete [] mCtrlPoints;
			exit(1);
		}

		if (event.getChar() == 'p') {
			if (mParams.isVisible()) {
				mParams.hide();
			} else { 
				mParams.show();
			}
		}

		if (event.getCode() == KeyEvent::KEY_F1) { mScale = 0.5;	}
		if (event.getCode() == KeyEvent::KEY_F2) { mMeshMode  = (!mMeshMode); }
		if (event.getCode() == KeyEvent::KEY_F12) { resetMesh(); }
		
		if (event.getCode() == KeyEvent::KEY_F5) { 
			if (mHasMovie) mMovie.stop();
			mDispMode = DispMode_GUIDE; 
		}
		if (event.getCode() == KeyEvent::KEY_F6) { 
			if (mHasMovie) mMovie.stop();
			mDispMode = DispMode_GUIDE1; 
		}
		if (event.getCode() == KeyEvent::KEY_F7) { 
			if (mHasMovie) mMovie.stop();
			mDispMode = DispMode_GUIDE2; 
		}
		if (event.getCode() == KeyEvent::KEY_F8) { 
			if (mHasMovie) mMovie.stop();
			mDispMode = DispMode_GUIDE3; 
		}
		if (event.getCode() == KeyEvent::KEY_F9) { 
			if (mHasMovie) mMovie.stop();
			mDispMode = DispMode_GUIDE4; 
		}
		if (event.getCode() == KeyEvent::KEY_F10) { 
			if (mHasMovie) {
				mMovie.play();
				mDispMode = DispMode_MOVIE; 
			}
		}

/*
		if (event.getCode() == KeyEvent::KEY_SPACE)	{
			if (mDispMode == DispMode_GUIDE) {
				mDispMode = DispMode_MOVIE;
			} 
			else if (mDispMode == DispMode_MOVIE) {
				mDispMode = DispMode_GUIDE;
			}
		}
		*/

		Vec2f move = Vec2f::zero();
		if (event.getCode() == KeyEvent::KEY_UP)	{ move = Vec2f( 0, -1); }
		if (event.getCode() == KeyEvent::KEY_DOWN)	{ move = Vec2f( 0,  1); }
		if (event.getCode() == KeyEvent::KEY_LEFT)	{ move = Vec2f(-1,  0); }
		if (event.getCode() == KeyEvent::KEY_RIGHT) { move = Vec2f( 1,  0); }
		for (int k = 0; k < mCtrlPointsNum; ++k) {
			if (mCtrlPoints[k].isSelected) {
				mCtrlPoints[k].mag += move;
			}
		}
	}