本文整理汇总了C++中pressKey函数的典型用法代码示例。如果您正苦于以下问题:C++ pressKey函数的具体用法?C++ pressKey怎么用?C++ pressKey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pressKey函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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") );
}
示例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;
}
示例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") );
}
示例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
示例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();
}
示例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);
}
}
示例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());
}
示例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;
}
示例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();
}
示例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);
}
}
示例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;
}
}
示例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%") );
}
示例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") );
}
示例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;
}
}