• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pressKey函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pressKey函数的典型用法代码示例。如果您正苦于以下问题:C++ pressKey函数的具体用法?C++ pressKey怎么用?C++ pressKey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: keyboardCallback

GLvoid keyboardCallback(unsigned char key, int x, int y, jboolean up) {
	if (key == 127) {
		pressKey("DELETE", up);
	} else if (key == 27) {
		pressKey("BACK", up);

	} else if (key >= 32) {
		char keyString[] = { (char) key, 0 };
		pressKey(keyString, up);
	}
}
开发者ID:Fantu,项目名称:settlers-remake,代码行数:11,代码来源:NativeAreaWindow.c


示例2: TEST_F

TEST_F( Ginga, descriptor_moveLeft_moveRight_moveUp_moveDown1 ) {
	ASSERT_TRUE( play("descriptor/moveLeft_moveRight_moveUp_moveDown/moveLeft_moveRight_moveUp_moveDown.ncl") );
	ASSERT_TRUE( compareTo("blue360x288_red360x288_green360x288_yellow360x288_blueSelected") );
	ASSERT_TRUE( pressKey( ::util::key::cursor_down ));
	ASSERT_TRUE( compareTo("blue360x288_red360x288_green360x288_yellow360x288_redSelected") );
	ASSERT_TRUE( pressKey( ::util::key::cursor_right ));
	ASSERT_TRUE( compareTo("blue360x288_red360x288_green360x288_yellow360x288_yellowSelected") );
	ASSERT_TRUE( pressKey( ::util::key::cursor_up ));
	ASSERT_TRUE( compareTo("blue360x288_red360x288_green360x288_yellow360x288_greenSelected") );
	ASSERT_TRUE( pressKey( ::util::key::cursor_left ));
	ASSERT_TRUE( compareTo("blue360x288_red360x288_green360x288_yellow360x288_blueSelected") );
}
开发者ID:jgrande,项目名称:ginga,代码行数:12,代码来源:moveLeft_moveRight_moveUp_moveDown.cpp


示例3: main

int main() {
	usbBegin();
	PORTB |= _BV(PB0); // Pullup on button

    while(1) {
        usbPoll();

		if(!(PINB & _BV(PB0))) { // button pressed
            pressKey(KEYCODE_MOD_LEFT_SHIFT, KEYCODE_A); // press
            pressKey(0, 0); // release
        }
    }
	
    return 0;
}
开发者ID:jokkebk,项目名称:TrinketKeyboard,代码行数:15,代码来源:main.c


示例4: TEST_F

TEST_F( Ginga, media_dinamic_width2 ) {
	ASSERT_TRUE( play("media/width/dinamic_width2.ncl") );
	ASSERT_TRUE( compareTo("blue720x576") );
	ASSERT_TRUE( pressKey( ::util::key::red ));
	ASSERT_TRUE( compareTo("blue360x576_black360x576") );

}
开发者ID:jgrande,项目名称:ginga,代码行数:7,代码来源:dinamic_width.cpp


示例5: pressKey

// addChar
//--------------------------------------------------------------------------
void cInputField::addChar(int newChar)
{
    pressKey(newChar);
    // Check if the character should be excluded.
    if (strchr(excludedCharacters, newChar) == 0) {
        
        // Add the character.
        if(insertMode) {
            // ins, move stuff forward
            if((cursorPos+1)<maxCharCount) {
                memmove(destString+cursorPos+1,destString+cursorPos,
                    maxCharCount-(cursorPos+1));
            }
        }
        int replacedChar=destString[cursorPos];
        destString[cursorPos] = newChar;
        if (cursorPos <= maxCharCount) {
            if(replacedChar=='\0') destString[cursorPos+1] = '\0';
        } else {
            destString[maxCharCount] = '\0';
        }

        assert(cursorPos < maxCharCount);

        if (cursorPos < maxCharCount - 1) {
            cursorPos++;
        }
    }

    if(textaction != 0)
        textaction(this);
} // addChar
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:34,代码来源:cInputField.cpp


示例6: s3eKeyboardUpdate

void SceneGame::update() {
	unsigned int i;

	// if keyboard is up, check for key press
	if(keyboardUp) {
		// update the keyboard state
		s3eKeyboardUpdate();

		// see if a key is pressed
		for(i=0; i<26; i++) {
			if(s3eKeyboardGetState(s3eKeys[i]) != 0) {
				pressKey(i);
				playInputSound();
			}
		}
	}

	// check for back button pressed
	if(s3eKeyboardGetState(s3eKeyAbsBSK) != 0) {
		GameButtonMenu* buttonMenu = (GameButtonMenu*)this->getChildByTag(SceneGameTagButtonMenu);
		buttonMenu->buttonPressed();
	}
	
	// update the other nodes
	IGNode::update();
}
开发者ID:9cat,项目名称:Cryptose,代码行数:26,代码来源:scene_game.cpp


示例7: keyboardSpecialCallback

GLvoid keyboardSpecialCallback(int key, int x, int y, jboolean up) {
	char* keyString = NULL;

	switch (key) {
	case GLUT_KEY_F1:
		keyString = "F1";
		break;
	case GLUT_KEY_F2:
		keyString = "F2";
		break;
	case GLUT_KEY_F3:
		keyString = "F3";
		break;
	case GLUT_KEY_F4:
		keyString = "F4";
		break;
	case GLUT_KEY_F5:
		keyString = "F5";
		break;
	case GLUT_KEY_F6:
		keyString = "F6";
		break;
	case GLUT_KEY_F7:
		keyString = "F7";
		break;
	case GLUT_KEY_F8:
		keyString = "F8";
		break;
	case GLUT_KEY_F9:
		keyString = "F9";
		break;
	case GLUT_KEY_F10:
		keyString = "F10";
		break;
	case GLUT_KEY_F11:
		keyString = "F11";
		break;
	case GLUT_KEY_F12:
		keyString = "F12";
		break;
	case GLUT_KEY_LEFT:
		keyString = "LEFT";
		break;
	case GLUT_KEY_RIGHT:
		keyString = "RIGHT";
		break;
	case GLUT_KEY_UP:
		keyString = "UP";
		break;
	case GLUT_KEY_DOWN:
		keyString = "DOWN";
		break;
	}

	if (keyString != NULL ) {
		pressKey(keyString, up);
	}
}
开发者ID:Fantu,项目名称:settlers-remake,代码行数:58,代码来源:NativeAreaWindow.c


示例8: TEST_F

TEST_F(TestVendorInScene, movesDownWhenDownDirectionPressedAndInLeftAisle)
{
    sut->setX(constantValues::LEFT_VERTICAL_AISLE_LOCATION);
    QPointF originalPos = sut->pos();

    pressKey(Qt::Key_Down);
    QPointF updatedPos = sut->pos();

    EXPECT_EQ(originalPos.x(), updatedPos.x());
    EXPECT_EQ(originalPos.y() + constantValues::MOVEMENT_AMOUNT, updatedPos.y());
}
开发者ID:jessharrell,项目名称:vendor-game,代码行数:11,代码来源:vendorTests.cpp


示例9: while

void Macro::playMacro(){
    int i;
    i = 0;
    while(macro[i] != 0) //reads off first 100 keys
    {
            qDebug() << macro[i];
            pressKey(macro[i]);
            Sleep(delay);
            i++;//keys are stored as ascii integers; see www.asciitable.com
    }
    playing = 0;
}
开发者ID:calebickler,项目名称:Capstone_Qt_Cpp_Program,代码行数:12,代码来源:Macro.cpp


示例10: pressKey

void keyMouse::applyKeys(){
	INPUT eventPress = {0};
	INPUT eventRelease = {0};
	bool send = false;

	//Check if there is anything new to press
	for(std::vector<std::string>::size_type i = 0; i != buttons.size(); i++) {
		//if in buttons and not in buttonsOld press it
		if(!(std::find(buttonsOld.begin(), buttonsOld.end(), buttons[i]) != buttonsOld.end())){
			// buttonsOld does not contain buttons[i] so press the button
			if(buttons[i].find("KEY") != std::string::npos){
				pressKey(eventPress, bmap[buttons[i]]);
				send = true;
			}else if(buttons[i].find("MOUSE") != std::string::npos){
				pressMouse(eventPress, bmap[buttons[i]]);
				send = true;
			}else if(buttons[i].find("MOTION") != std::string::npos){
				send = false;
				processMotionPress(buttons[i]);
			}
			if(send == true){
				SendInput( 1, &eventPress, sizeof( eventPress ) );
			}
		}
	}

	//Check if anything that was pressed last time is now unpressed
	for(std::vector<std::string>::size_type i = 0; i != buttonsOld.size(); i++) {
		//if in buttonsOld and not in buttons release it
		if( !(std::find(buttons.begin(), buttons.end(), buttonsOld[i]) != buttons.end())) {
			// buttons does not contain buttonsOld[i] so release the button press
			if(buttonsOld[i].find("KEY") != std::string::npos){
				releaseKey(eventRelease, bmap[buttonsOld[i]]);
				send = true;
			//	std::cout << " ReleaseKey: " << buttonsOld[i] << "\n";
			}else if(buttonsOld[i].find("MOUSE") != std::string::npos){
				releaseMouse(eventRelease, bmap[buttonsOld[i]]);
				send = true;
				//std::cout << " ReleaseMouse: " << buttonsOld[i] << "\n";
			}else if(buttonsOld[i].find("MOTION") != std::string::npos){
				send = false;
				processMotionRelease(buttonsOld[i]);
			}
			if(send == true){
				SendInput( 1, &eventRelease, sizeof( eventRelease ) );
			}
		}
	}
	buttonsOld = buttons;
	//clear the vector
	buttons.clear();
}
开发者ID:jamesmorrisstudios,项目名称:motion_controller_pc,代码行数:52,代码来源:keyboardMouse.cpp


示例11: pressKey

 void Keyboard::onEvent(const SDL_Event& event)
 {
     if (event.type == SDL_KEYDOWN)
     {
         if (!event.key.repeat)
         {
             pressKey(event.key.keysym.scancode);
         }
     }
     if (event.type == SDL_KEYUP)
     {
         releaseKey(event.key.keysym.scancode);
     }
 }
开发者ID:eugeneyche,项目名称:tiny,代码行数:14,代码来源:keyboard.cpp


示例12: switch

void KeyTracker::keyEvent(QKeyEvent *event)
{
	switch (event->type())
	{
		case QEvent::KeyPress:
			
			pressKey(event->key());
			setModifiers(event->modifiers());
			break;
			
		case QEvent::KeyRelease:
			
			releaseKey(event->key());
			break;
			
		default:
			
			break;
	}
}
开发者ID:pasberth,项目名称:PaintField,代码行数:20,代码来源:keytracker.cpp


示例13: TEST_F

TEST_F( Ginga, media_dinamic_transparency1 ) {
	ASSERT_TRUE( play("media/transparency/dinamic_transparency1.ncl") );
	ASSERT_TRUE( compareTo("blue720x576") );
	ASSERT_TRUE( pressKey( ::util::key::red ));
	ASSERT_TRUE( compareTo("transparency50%") );
}
开发者ID:jgrande,项目名称:ginga,代码行数:6,代码来源:dinamic_transparency.cpp


示例14: TEST_F

TEST_F( Ginga, media_dinamic_fontStyle1 ) {
	ASSERT_TRUE( play("media/fontStyle/dinamic_fontStyle1.ncl") );
	ASSERT_TRUE( compareTo("standardText") );
	ASSERT_TRUE( pressKey( ::util::key::red ));
	ASSERT_TRUE( compareTo("standardText_italic") );
}
开发者ID:jgrande,项目名称:ginga,代码行数:6,代码来源:dinamic_fontStyle.cpp


示例15: postKeyMessage

static void postKeyMessage(int x, int y, unsigned int msg)
{
	SetForegroundWindow(windowFromPoint(x, y));
	switch(msg)
	{
	case 'a' : pressKey(A); break;
	case 'b' : pressKey(B); break;
	case 'A' : pressShifted(A);break;
	case '1' : pressKey(ONE); break;
	case '2' : pressKey(TWO); break;
	case '3' : pressKey(THREE); break;
	case '4' : pressKey(FOUR); break;
	case '5' : pressKey(FIVE); break;
	case '6' : pressKey(SIX); break;
	case '7' : pressKey(SEVEN); break;
	case '8' : pressKey(EIGHT); break;
	case '9' : pressKey(NINE); break;
	case '0' : pressKey(ZERO); break;
	case '\t' : pressKey(TAB); break;
	case '\n' : pressKey(ENTER); break;
	}
	
}
开发者ID:seokhohong,项目名称:PathOfExile,代码行数:23,代码来源:NativeMacro.c


示例16: TEST_F

TEST_F( Ginga, media_dinamic_bottom14 ) {
	ASSERT_TRUE( play("media/bottom/dinamic_bottom14.ncl") );
	ASSERT_TRUE( compareTo("blue720x576") );
	ASSERT_TRUE( pressKey( ::util::key::red ));
	ASSERT_TRUE( compareTo("blue720x288_black720x288") );
}
开发者ID:jgrande,项目名称:ginga,代码行数:6,代码来源:dinamic_bottom.cpp


示例17: TEST_F

TEST_F( Ginga, media_dinamic_height8 ) {
	ASSERT_TRUE( play("media/height/dinamic_height8.ncl") );
	ASSERT_TRUE( compareTo("blue720x288_black720x288") );
	ASSERT_TRUE( pressKey( ::util::key::red ));
	ASSERT_TRUE( compareTo("blue720x288_black720x288") );
}
开发者ID:jgrande,项目名称:ginga,代码行数:6,代码来源:dinamic_height.cpp


示例18: pressShifted

static void pressShifted(unsigned int key)
{
	keybd_event(SHIFT, 0, 0, 0);
	pressKey(key);
	keybd_event(SHIFT, 0, KEYEVENTF_KEYUP, 0);
}
开发者ID:seokhohong,项目名称:PathOfExile,代码行数:6,代码来源:NativeMacro.c


示例19: TEST_F

TEST_F( Ginga, media_dinamic_visible1 ) {
	ASSERT_TRUE( play("media/visible/dinamic_visible1.ncl") );
	ASSERT_TRUE( compareTo("blue720x576") );
	ASSERT_TRUE( pressKey( ::util::key::red ));
	ASSERT_TRUE( compareTo("black720x576") );
}
开发者ID:jgrande,项目名称:ginga,代码行数:6,代码来源:dinamic_visible.cpp


示例20: _T

void KeyMap::PCtoX(BYTE virtKey, DWORD keyData, ClientConnection* clientCon)
{
    bool down = ((keyData & 0x80000000) == 0);
    bool extended = ((keyData & 0x1000000) != 0);
    bool repeated = ((keyData & 0xc0000000) == 0x40000000);
    UINT extVkey = virtKey + (extended ? 256 : 0);

	// exclude winkey when not scroll-lock
	if (virtKey==91 || virtKey==92) return;

   vnclog.Print(8, _T("\nPCtoX: %svirtKey 0x%02x%s%s, keyData 0x%08x\n"),
              (extended ? _T("extended ") : _T("")), virtKey,
              (repeated ? _T(" repeated") : _T("")),
              (down ? _T(" down") : _T(" up")), keyData);

    // If this is a key release then just send the associated sent KeySym when
    //   this key was pressed
    if (!down) {
     vnclog.Print(8, _T("Release the associated KeySym when this VirtKey was pressed\n"));

      if (downUnicode[extVkey]) {
         vnclog.Print(8, _T("  0x%04x (%c): "), downUnicode[extVkey], downUnicode[extVkey]);
          downUnicode[extVkey] = NULL;
      } else {
         vnclog.Print(8, _T("  Control character: "));
      }

      releaseKey(clientCon, extVkey);
     vnclog.Print(8, _T("\n"));
	 GetKeyboardState(KBKeysState);
    if (!((KBKeysState[VK_MENU] & 0x80) && (KBKeysState[VK_CONTROL] & 0x80)))
	{
	 if (storedDeadChar && reset) {
 	 reset=false;
	 keybd_event(VK_SPACE, 0, 0, 0);
	 keybd_event(VK_SPACE, 0, KEYEVENTF_KEYUP, 0);
	 }
	}
      return;
    }

    // We try to look it up in our key table
    // Look up the desired code in the keyMap table try to find the exact match according to
    //   the extended flag, then try the opposite of the extended flag
    CARD32 foundXCode = XK_VoidSymbol;
    bool exactMatched = false;
   vnclog.Print(8, _T("Looking in key table "));

    for (UINT i = 0; i < (sizeof(keyMap) / sizeof(vncKeyMapping_t)); i++) {
        if (keyMap[i].WinCode == virtKey) {
            foundXCode = keyMap[i].XCode;
            if (extended == keyMap[i].extVK) {
                exactMatched = true;
                break;
            }
        }
    }

    if (foundXCode != XK_VoidSymbol) {
       vnclog.Print(8, _T("-> keyMap gives (from %s extended flag) KeySym %u (0x%08x)\n"),
                  (exactMatched ? _T("matched") : _T("opposite")),
                  foundXCode, foundXCode);
        pressKey(clientCon, extVkey, foundXCode);
       vnclog.Print(8, _T("\n"));
        return;
    } else {
       vnclog.Print(8, _T("-> not in special keyMap\n"));
    }

    // Under CE, we're not so concerned about this bit because we handle a WM_CHAR message later
#ifndef UNDER_CE
    GetKeyboardState(KBKeysState);

    ModifierKeyReleaser lctrl(clientCon, VK_CONTROL, 0);
    ModifierKeyReleaser lalt(clientCon, VK_MENU, 0);
    ModifierKeyReleaser ralt(clientCon, VK_MENU, 1);

    if ((KBKeysState[VK_MENU] & 0x80) && (KBKeysState[VK_CONTROL] & 0x80)) {
        // This is a Ctrl-Alt (AltGr) key on international keyboards (= LCtrl-RAlt)
        // Ex. Ctrl-Alt-Q gives '@' on German keyboards
       vnclog.Print(8, _T("Ctrl-Alt pressed:\n"));

        // We must release Control and Alt (AltGr) if they were both pressed, so the character
        //   is seen without them by the VNC server
        // We don't release the Right Control; this allows German users
        //   to use it for doing Ctrl-AltGr-x, e.g. [email protected], etc
        lctrl.release(downKeysym);
        lalt.release(downKeysym);
        ralt.release(downKeysym);
    } else {
        // This is not a Ctrl-Alt (AltGr) key
       vnclog.Print(8, _T("Ctrl-Alt not pressed, fake release any Ctrl key\n"));

        // There are no KeySym corresponding to control characters, e.g. Ctrl-F
        // The server has already known whether the Ctrl key is pressed from the previouse key event
        // So we are interested in the key that would be there if the Ctrl key were not pressed
        KBKeysState[VK_CONTROL] = KBKeysState[VK_LCONTROL] = KBKeysState[VK_RCONTROL] = 0;
    }

	int ret;
//.........这里部分代码省略.........
开发者ID:thiagomoreiraboby,项目名称:SuporteOnline,代码行数:101,代码来源:KeyMap.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pressanykey函数代码示例发布时间:2022-05-30
下一篇:
C++ press函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap