本文整理汇总了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());
}
}
示例2: keyDown
void FolApp::keyDown(KeyEvent event)
{
if (event.getChar() == 'f')
setFullScreen(!isFullScreen());
if (event.getCode() == KeyEvent::KEY_ESCAPE)
quit();
}
示例3: keyDown
void ciUISimpleExampleApp::keyDown( KeyEvent event )
{
if(event.getChar() == 'g')
{
gui->toggleVisible();
}
}
示例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;
}
}
示例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;
}
}
}
示例6: keyDown
void KinectStreamerApp::keyDown(KeyEvent event)
{
if (event.getChar()==' ')
{
mSettings.reload();
}
}
示例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;
}
}
示例8: keyDown
void cApp::keyDown( KeyEvent event ){
switch( event.getChar() ){
case 'S': mExp.startRender(); break;
case 's': mExp.snapShot(); break;
case ' ': bStart = !bStart; break;
}
}
示例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();
}
}
}
示例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;
}
示例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;
}
}
示例12: keyDown
void DartBasicApp::keyDown( KeyEvent event )
{
if( event.getChar() == 'r' ) {
CI_LOG_V( "reload." );
loadScript();
}
}
示例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();
}
}
示例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;
}
}
示例15: keyDown
void rayMarcherApp::keyDown( KeyEvent event )
{
if( event.getChar() == 's' ) {
mMarcher.randomScene();
mCurrentLine = 0;
}
}