void doRepeatActions() { al_get_keyboard_state(&keyboard); int32_t keymod = getKeyMods(&keyboard); for(int keycode=0; keycode<ALLEGRO_KEY_UNKNOWN; keycode++) { if(isRepeatable(keycode) && al_key_down(&keyboard,keycode)) { doKey(keycode, keymod); } } }
void doKeys(int32_t key, uint32_t keymod) { if(!isRepeatable(key)) { doKey(key,keymod); } return; //WAITING TO BE MOVED OVER //if(ssConfig.debug_mode) { // if(Key == ALLEGRO_KEY_PAD_8) { // ssConfig.follow_DFcursor = false; // debugCursor.y--; // paintboard(); // } // if(Key == ALLEGRO_KEY_PAD_2) { // ssConfig.follow_DFcursor = false; // debugCursor.y++; // paintboard(); // } // if(Key == ALLEGRO_KEY_PAD_4) { // ssConfig.follow_DFcursor = false; // debugCursor.x--; // paintboard(); // } // if(Key == ALLEGRO_KEY_PAD_6) { // ssConfig.follow_DFcursor = false; // debugCursor.x++; // paintboard(); // } // if(Key == ALLEGRO_KEY_F10) { // if(ssConfig.spriteIndexOverlay == false) { // ssConfig.spriteIndexOverlay = true; // ssConfig.currentSpriteOverlay = -1; // } else { // ssConfig.currentSpriteOverlay ++; // if(ssConfig.currentSpriteOverlay >= IMGFilenames.size()) { // ssConfig.currentSpriteOverlay = -1; // } // } // } // if(Key == ALLEGRO_KEY_SPACE) { // if(ssConfig.spriteIndexOverlay == true) { // ssConfig.spriteIndexOverlay = false; // } // } //} }
//0:exit,1:continue int CwxBinlogOp::doCommand(char* szCmd) { string strCmd; list < string > value; CwxCommon::trim(szCmd); strCmd = szCmd; CwxCommon::split(strCmd, value, ' '); list<string>::iterator iter = value.begin(); //remove the empty value while (iter != value.end()) { if ((*iter).length() == 0) { value.erase(iter); iter = value.begin(); continue; } iter++; } if (value.size() == 0) return 1; iter = value.begin(); CWX_UINT32 uiItemNum = value.size(); if (0 == strcasecmp((*iter).c_str(), "help")) { doHelp(); } else if (0 == strcasecmp((*iter).c_str(), "info")) { doInfo(); } else if (0 == strcasecmp((*iter).c_str(), "next")) { CWX_UINT32 uiNum = 1; if (1 != uiItemNum) { iter++; uiNum = strtoul((*iter).c_str(), NULL, 0); } doNext(uiNum); } else if (0 == strcasecmp((*iter).c_str(), "prev")) { CWX_UINT32 uiNum = 1; if (1 != uiItemNum) { iter++; uiNum = strtoul((*iter).c_str(), NULL, 0); } doPrev(uiNum); } else if (0 == strcasecmp((*iter).c_str(), "sid")) { if (2 != uiItemNum) { printf("Invalid sid command, using: sid value.\n"); return 1; } iter++; doSid(strtoull((*iter).c_str(), NULL, 0)); } else if (0 == strcasecmp((*iter).c_str(), "rec")) { if (2 != uiItemNum) { printf("Invalid rec command, using: rec value.\n"); return 1; } iter++; doRecord(strtoul((*iter).c_str(), NULL, 0)); } else if (0 == strcasecmp((*iter).c_str(), "group")) { if (2 != uiItemNum) { printf("Invalid group command, using: group value.\n"); return 1; } iter++; doGroup(strtoul((*iter).c_str(), NULL, 0)); } else if (0 == strcasecmp((*iter).c_str(), "key")) { if (3 != uiItemNum) { printf("Invalid key command, using: key k v.\n"); return 1; } iter++; string strKey = *iter; doKey(strKey.c_str(), (*iter).c_str()); } else if (0 == strcasecmp((*iter).c_str(), "head")) { doHead(); } else if (0 == strcasecmp((*iter).c_str(), "data")) { doData(); } else if (0 == strcasecmp((*iter).c_str(), "save")) { if (1 == uiItemNum) { printf("Invalid save command, using: save file.\n"); return 1; } iter++; doSave(*iter); } else if (0 == strcasecmp((*iter).c_str(), "exit")) { return 0; } else { printf("Invalid command %s\n", (*iter).c_str()); doHelp(); } return 1; }
unsigned long getCode(void) { doKey(KEY_A, 0); doKey(KEY_B, 1); doKey(KEY_C, 2); doKey(KEY_D, 3); doKey(KEY_Betty, 4); doKey(KEY_Exit, 5); doKey(KEY_Up, 6); doKey(KEY_Down, 7); doKey(KEY_Left, 8); doKey(KEY_Right, 9); doKey(KEY_OK, 10); doKey(KEY_Vplus, 11); doKey(KEY_Vminus, 12); doKey(KEY_Mute, 13); doKey(KEY_Pplus, 14); doKey(KEY_Pminus, 15); doKey(KEY_1, 16); doKey(KEY_2, 17); doKey(KEY_3, 18); doKey(KEY_4, 19); doKey(KEY_5, 20); doKey(KEY_6, 21); doKey(KEY_7, 22); doKey(KEY_8, 23); doKey(KEY_9, 24); doKey(KEY_0, 25); doKey(KEY_Minus, 26); doKey(KEY_AV, 27); doKey(KEY_Menu, 28); doKey(KEY_PiP, 29); doKey(KEY_AB, 30); doKey(KEY_16_9, 31); doKey(KEY_Info, 32); doKey(KEY_VTX1, 33); doKey(KEY_VTX2, 34); doKey(KEY_VTX3, 35); doKey(KEY_Blue, 36); doKey(KEY_Yellow, 37); doKey(KEY_Green, 38); doKey(KEY_Red, 39); doKey(KEY_TV, 40); doKey(KEY_Power, 41); return 0xFFFFFFFF; }