当前位置: 首页>>代码示例>>C++>>正文


C++ KeyEvent::getChar方法代码示例

本文整理汇总了C++中KeyEvent::getChar方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyEvent::getChar方法的具体用法?C++ KeyEvent::getChar怎么用?C++ KeyEvent::getChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KeyEvent的用法示例。


在下文中一共展示了KeyEvent::getChar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: writeImage

void ImageBasedLighting_05App::keyDown(KeyEvent event) {
    if(event.getChar() == 's') {
        std::string s = std::to_string(count);
        count++;
        writeImage("pbr"+s+".png", copyWindowSurface());
    }
}
开发者ID:yiwenl,项目名称:PBR_Learning,代码行数:7,代码来源:ImageBasedLighting_05App.cpp

示例2: keyDown

void FolApp::keyDown(KeyEvent event)
{
    if (event.getChar() == 'f')
        setFullScreen(!isFullScreen());
    if (event.getCode() == KeyEvent::KEY_ESCAPE)
        quit();
}
开发者ID:gaborpapp,项目名称:apps,代码行数:7,代码来源:FolApp.cpp

示例3: keyDown

void ciUISimpleExampleApp::keyDown( KeyEvent event )
{
    if(event.getChar() == 'g')
    {
        gui->toggleVisible(); 
    }
}
开发者ID:Dewb,项目名称:ciUI,代码行数:7,代码来源:ciUISimpleExampleApp.cpp

示例4: keyUp

void KeyboardApp::keyUp( KeyEvent event )
{
	switch(event.getChar())
	{
	case 'w':
		KEY_W =false;
		break;
	case 's':
		KEY_S = false;
		break;
	case 'a':
		KEY_A = false;
		break;
	case 'd':
		KEY_D = false;
		break;
	}
	switch(event.getCode())
	{
	case KeyEvent::KEY_UP:
		KEY_UP = false;
	case 276:
		KEY_LEFT = false;
		break;
	case KeyEvent::KEY_RIGHT:
		KEY_RIGHT = false;
		break;
	case KeyEvent::KEY_SPACE:
		KEY_SPACE = false;
		break;
	}
}
开发者ID:Khramium,项目名称:BulletHell,代码行数:32,代码来源:KeyboardApp.cpp

示例5: switch

void P_1_1_2_01::keyDown( KeyEvent event ){
    char keyPressed = event.getChar();
    switch (keyPressed) {
        case '1':{
            segmentCount = 360.f;
            break;
        }
        case '2':{
            segmentCount = 36.f;
        }
            break;
        case '3':{
            segmentCount = 18.f;
        }
            break;
        case '4':{
            segmentCount = 12.f;
        }
            break;
        case '5':{
            segmentCount = 6.f;
        }
            break;
        case 's':
        case 'S':{
            vector<std::string> fileTypes;
            fileTypes.push_back("png");
            fs::path path = getSaveFilePath("", fileTypes);
            writeImage( path.string() , copyWindowSurface() );
            break;
        }
    }
}
开发者ID:wildparadox,项目名称:Generative_Design_Cinder,代码行数:33,代码来源:P_1_1_2_01.cpp

示例6: keyDown

void KinectStreamerApp::keyDown(KeyEvent event)
{
	if (event.getChar()==' ')
	{
		mSettings.reload();
	}
}
开发者ID:timmb,项目名称:Ensemble,代码行数:7,代码来源:KinectStreamerApp.cpp

示例7: keyDown

//*************************************************************************
void BeatDetectorApp::keyDown(KeyEvent event)
{
	switch(event.getChar())
	{
		case 'n':
			NextFile();
			break;
		case 'f':
			setFullScreen(!isFullScreen());
			break;
		case 'p':
			if(mTrack)
			{
				if(mTrack->isPlaying())
				{
					mTrack->stop();
				}
				else
				{
					mTrack->play();
				}
			}
			break;
	}
}
开发者ID:merf,项目名称:VisualiserTestbed,代码行数:26,代码来源:KissFileSampleApp.cpp

示例8: keyDown

void cApp::keyDown( KeyEvent event ){
    switch( event.getChar() ){
        case 'S': mExp.startRender(); break;
        case 's': mExp.snapShot(); break;
        case ' ': bStart = !bStart; break;
    }
}
开发者ID:stdmtb,项目名称:uf_0.9.0,代码行数:7,代码来源:cApp.cpp

示例9: processNumerical

// manually build a string of numerical digits, filtering out everything else
void iosKeyboardApp::processNumerical( const KeyEvent &event )
{
	if( event.getCode() == KeyEvent::KEY_BACKSPACE && ! mNumericalTextView.mText.empty() )
		mNumericalTextView.mText.pop_back();
	else if( isdigit( event.getChar() ) ) {
		mNumericalTextView.mText.push_back( event.getChar() );
		Rectf fitRect = mNumericalTextView.getTextBounds();
		TextBox tbox = TextBox().font( mFont ).text( mNumericalTextView.mText ).size( TextBox::GROW, TextBox::GROW );
		vec2 size = tbox.measure();

		if( size.x > fitRect.getWidth() ) {
			console() << "OVERFLOW" << endl;
			mNumericalTextView.mText.pop_back();
		}
	}
}
开发者ID:ChristophPacher,项目名称:Cinder,代码行数:17,代码来源:iosKeyboardApp.cpp

示例10: keyDown

void TerrainApp::keyDown( KeyEvent event )
{
	switch ( event.getChar() ) {
		case ' ':	mRoom.togglePower();
					mSpringCam.setPreset( 1 );	break;
		case 'f':	mRd.mParamF += 0.001f;		break;
		case 'F':	mRd.mParamF -= 0.001f;		break;
		case 'k':	mRd.mParamK += 0.001f;		break;
		case 'K':	mRd.mParamK -= 0.001f;		break;
		case 'n':	mRd.mParamN += 0.005f;		break;
		case 'N':	mRd.mParamN -= 0.005f;		break;
		case 'w':	mRd.mParamWind += 0.05f;	break;
		case 'W':	mRd.mParamWind -= 0.05f;	break;
		case '.':	mTerrainScale.x += 0.1f;	break;
		case ',':	mTerrainScale.x -= 0.1f;	break;
		case '1':	mRd.setMode(1);				break;
		case '2':	mRd.setMode(2);				break;
		case '3':	mRd.setMode(3);				break;
		case 'c':	mSpringCam.setPreset( 0 );	break;
		case 'C':	mSpringCam.setPreset( 2 );	break;
		default:								break;
	}
	
	switch( event.getCode() ){
		case KeyEvent::KEY_UP:		mMouseRightPos = Vec2f( 222.0f, 205.0f ) + getWindowCenter();	break;
		case KeyEvent::KEY_LEFT:	mMouseRightPos = Vec2f(-128.0f,-178.0f ) + getWindowCenter();	break;
		case KeyEvent::KEY_RIGHT:	mMouseRightPos = Vec2f(-256.0f, 122.0f ) + getWindowCenter();	break;
		case KeyEvent::KEY_DOWN:	mMouseRightPos = Vec2f(   0.0f,   0.0f ) + getWindowCenter();	break;
		default: break;
	}
	
	std::cout << "F: " << mRd.mParamF << " K: " << mRd.mParamK << std::endl;
}
开发者ID:AlanChatham,项目名称:Eyeo2012,代码行数:33,代码来源:TerrainApp.cpp

示例11: if

void Homework02App::keyDown(KeyEvent event)
{	
	//Handles if the user wishes to toggle the instructions on and off. 
	switch(event.getChar()) {
		case '?':
			if (toggleOn)
			{
			mFont = Font(mFont.getName(), mFont.getSize());
			mTextureFont = gl::TextureFont::create(mFont);
			toggleOn = false;
			}

			else if (toggleOn == false) 
			{
			tempFont = Font("", 0);
			mTextureFont = gl::TextureFont::create(tempFont);
			toggleOn = true;
			}
		break;
		
		// Handles if the user wishes to reverse the items 
		case 'R':
		case 'r':
			reverse(sentinel);
		break;

		case 'A':
		case 'a':
	
		break;
	}
}
开发者ID:marsdems,项目名称:Homework02,代码行数:32,代码来源:Homework02App.cpp

示例12: keyDown

void DartBasicApp::keyDown( KeyEvent event )
{
	if( event.getChar() == 'r' ) {
		CI_LOG_V( "reload." );
		loadScript();
	}
}
开发者ID:num3ric,项目名称:Cinder-Dart,代码行数:7,代码来源:DartBasicApp.cpp

示例13:

void Willard_HW02_Linked_ListApp::keyDown(KeyEvent event)
{

	if(event.getCode() == KeyEvent::KEY_r){
		reverseList(sentinel);
	}

	char yup = event.getChar();
	if(yup == '/' || yup == '?')
	{
	if(showMenu){
		showMenu = false;
	} else{
		showMenu = true;
		}
	}

	// I can't figure out what these next two events do in your code. Are they functioning?
	if(event.getCode() == KeyEvent::KEY_SPACE){
		reverseList(sentinel);
	}

	if(event.getCode() == KeyEvent::KEY_UP){
		toTop();
	}
}
开发者ID:Taylor-Reid,项目名称:Willard_HW02_Linked_List,代码行数:26,代码来源:Willard_HW02_Linked_ListApp.cpp

示例14: keyDown

void FrownLogoParticlesApp::keyDown( KeyEvent event )
{

    if ( event.getChar() == ' ')
    {
        //Pressing the spacebar causes the particles to change direction
        // in one case they are making up the word "Frown"
        // and in the other case "Frown" explodes into particles.
        
        mKeyPressed = !mKeyPressed;
    } else if ( ( event.getChar() == 'P' ) || ( event.getChar() == 'p' ) )
    {
        // Pause and "unpause" using the p ( or P ) key
        mPaused = !mPaused;
    }
}
开发者ID:4nt0n,项目名称:CinderSeminarFrown,代码行数:16,代码来源:FrownLogoParticlesApp.cpp

示例15: keyDown

void rayMarcherApp::keyDown( KeyEvent event )
{
    if( event.getChar() == 's' ) {
        mMarcher.randomScene();
        mCurrentLine = 0;
    }
}
开发者ID:rkabir,项目名称:Cinder,代码行数:7,代码来源:rayMarcherApp.cpp


注:本文中的KeyEvent::getChar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。