// Set button values void Dialog::repopulate() { for (int gamepad_id = 0; gamepad_id < GAMEPAD_NUMBER; ++gamepad_id) { for (int key = 0; key < MAX_KEYS; key++) { if (get_key(gamepad_id, key) != 0) { m_bt_gamepad[gamepad_id][key]->SetLabel( KeyName(gamepad_id, key).c_str()); m_map_images[gamepad_id][get_key(gamepad_id, key)] = key; } } // keyboard/mouse key map<u32, u32>::iterator it; for (it = conf->keysym_map[gamepad_id].begin(); it != conf->keysym_map[gamepad_id].end(); ++it) { int keysym = it->first; int key = it->second; m_bt_gamepad[gamepad_id][key]->SetLabel( KeyName(gamepad_id, key, keysym).c_str()); m_simulatedKeys[gamepad_id][key] = keysym; m_map_images[gamepad_id][keysym] = key; } } }
static void PrintEvent(const Event& event) { switch (event.Type) { case Event::EVENT_CLOSED: std::cout << "Event: Window Closed" << std::endl; break; case Event::EVENT_MOVED: std::cout << "Event: Window Moved (" << event.Move.X << ", " << event.Move.Y << ")" << std::endl; break; case Event::EVENT_RESIZED: std::cout << "Event: Window Resized (" << event.Size.Width << ", " << event.Size.Height << ")" << std::endl; break; case Event::EVENT_LOST_FOCUS: std::cout << "Event: Window Lost Focus" << std::endl; break; case Event::EVENT_GAINED_FOCUS: std::cout << "Event: Window Gained Focus" << std::endl; break; case Event::EVENT_TEXT_ENTERED: // TODO(cwallez) show the character std::cout << "Event: Text Entered" << std::endl; break; case Event::EVENT_KEY_PRESSED: std::cout << "Event: Key Pressed (" << KeyName(event.Key.Code) << KeyState(event.Key) << ")" << std::endl; break; case Event::EVENT_KEY_RELEASED: std::cout << "Event: Key Released (" << KeyName(event.Key.Code) << KeyState(event.Key) << ")" << std::endl; break; case Event::EVENT_MOUSE_WHEEL_MOVED: std::cout << "Event: Mouse Wheel (" << event.MouseWheel.Delta << ")" << std::endl; break; case Event::EVENT_MOUSE_BUTTON_PRESSED: std::cout << "Event: Mouse Button Pressed " << MouseButtonName(event.MouseButton.Button) << " at (" << event.MouseButton.X << ", " << event.MouseButton.Y << ")" << std::endl; break; case Event::EVENT_MOUSE_BUTTON_RELEASED: std::cout << "Event: Mouse Button Released " << MouseButtonName(event.MouseButton.Button) << " at (" << event.MouseButton.X << ", " << event.MouseButton.Y << ")" << std::endl; break; case Event::EVENT_MOUSE_MOVED: std::cout << "Event: Mouse Moved (" << event.MouseMove.X << ", " << event.MouseMove.Y << ")" << std::endl; break; case Event::EVENT_MOUSE_ENTERED: std::cout << "Event: Mouse Entered Window" << std::endl; break; case Event::EVENT_MOUSE_LEFT: std::cout << "Event: Mouse Left Window" << std::endl; break; case Event::EVENT_TEST: std::cout << "Event: Test" << std::endl; break; default: UNREACHABLE(); break; } }
void C_ArchiveBindings (FILE *f) { int i; fprintf (f, "unbindall\n"); for (i = 0; i < NUM_KEYS; i++) if (Bindings[i].length()) fprintf (f, "bind \"%s\" \"%s\"\n", KeyName (i), Bindings[i].c_str()); for (i = 0; i < NUM_KEYS; i++) if (DoubleBindings[i].length()) fprintf (f, "doublebind \"%s\" \"%s\"\n", KeyName (i), DoubleBindings[i].c_str()); }
void repopulate() { GtkTreeIter toplevel; gtk_tree_store_clear(treestore); string pad_value; switch(show_pad) { case 0: pad_value = "Pad 1"; break; case 1: pad_value = "Pad 2"; break; default: pad_value = "Invalid"; break; } // joystick key if (show_joy_key[show_pad]) { for (int key = 0; key < MAX_KEYS; key++) { if (get_key(show_pad, key) != 0) { gtk_tree_store_append(treestore, &toplevel, NULL); gtk_tree_store_set(treestore, &toplevel, COL_PAD, pad_value.c_str(), COL_BUTTON, s_pGuiKeyMap[key], COL_KEY, KeyName(show_pad, key).c_str(), COL_PAD_NUM, show_pad, COL_VALUE, key, COL_KEYSYM, 0, -1); } } } // keyboard/mouse key if (show_keyboard_key[show_pad]) { map<u32,u32>::iterator it; for (it = conf->keysym_map[show_pad].begin(); it != conf->keysym_map[show_pad].end(); ++it) { int keysym = it->first; int key = it->second; gtk_tree_store_append(treestore, &toplevel, NULL); gtk_tree_store_set(treestore, &toplevel, COL_PAD, pad_value.c_str(), COL_BUTTON, s_pGuiKeyMap[key], COL_KEY, KeyName(show_pad, key, keysym).c_str(), COL_PAD_NUM, show_pad, COL_VALUE, key, COL_KEYSYM, keysym, -1); } } }
void FBaseParser::InsertMetaDataPair(TMap<FName, FString>& MetaData, const FString& InKey, const FString& InValue) { FString Key = InKey; FString Value = InValue; // trim extra white space and quotes Key = Key.Trim().TrimTrailing(); Value = Value.Trim().TrimTrailing(); Value = Value.TrimQuotes(); // make sure the key is valid if (InKey.Len() == 0) { FError::Throwf(TEXT("Invalid metadata")); } FName KeyName(*Key); FString* ExistingValue = MetaData.Find(KeyName); if (ExistingValue && Value != *ExistingValue) { FError::Throwf(TEXT("Metadata key '%s' first seen with value '%s' then '%s'"), *Key, **ExistingValue, *Value); } // finally we have enough to put it into our metadata MetaData.Add(FName(*Key), *Value); }
void FKeyBindings::PerformBind(FCommandLine &argv, const char *msg) { int i; if (argv.argc() > 1) { i = GetKeyFromName (argv[1]); if (!i) { Printf ("Unknown key \"%s\"\n", argv[1]); return; } if (argv.argc() == 2) { Printf ("\"%s\" = \"%s\"\n", argv[1], Binds[i].GetChars()); } else { Binds[i] = argv[2]; } } else { Printf ("%s:\n", msg); for (i = 0; i < NUM_KEYS; i++) { if (!Binds[i].IsEmpty()) Printf ("%s \"%s\"\n", KeyName (i), Binds[i].GetChars()); } } }
void Dialog::config_key(int pad, int key) { bool captured = false; u32 key_pressed = 0; // I don't have any guarantee that not-yet-pressed state is egual to released state GamePad::UpdateReleaseState(); while (!captured) { std::vector<GamePad *>::iterator itjoy; if (PollX11KeyboardMouseEvent(key_pressed)) { // special case for keyboard/mouse to handle multiple keys // Note: key_pressed == 0 when ESC is hit to abort the capture if (key_pressed > 0) { clear_key(pad, key); set_keyboard_key(pad, key_pressed, key); m_simulatedKeys[pad][key] = key_pressed; m_map_images[pad][key_pressed] = key; } captured = true; } else { GamePad::UpdateGamePadState(); itjoy = s_vgamePad.begin(); while ((itjoy != s_vgamePad.end()) && (!captured)) { if ((*itjoy)->PollButtons(key_pressed)) { clear_key(pad, key); set_key(pad, key, key_pressed); m_map_images[pad][key_pressed] = key; captured = true; } else if ((*itjoy)->PollAxes(key_pressed)) { clear_key(pad, key); set_key(pad, key, key_pressed); m_map_images[pad][key_pressed] = key; captured = true; } else if ((*itjoy)->PollHats(key_pressed)) { clear_key(pad, key); set_key(pad, key, key_pressed); m_map_images[pad][key_pressed] = key; captured = true; } ++itjoy; } } } m_bt_gamepad[pad][key]->SetLabel( KeyName(pad, key, m_simulatedKeys[pad][key]).c_str()); }
void C_ArchiveBindings (FILE *f) { int i; fprintf (f, "unbindall\n"); for (i = 0; i < NUM_KEYS; i++) { if (Bindings[i].length()) fprintf (f, "bind %s %s\n", C_QuoteString(KeyName(i)).c_str(), C_QuoteString(Bindings[i]).c_str()); } for (i = 0; i < NUM_KEYS; i++) { if (DoubleBindings[i].length()) fprintf (f, "doublebind %s %s\n", C_QuoteString(KeyName(i)).c_str(), C_QuoteString(DoubleBindings[i]).c_str()); } }
std::string C_NameKeys (int first, int second) { if(!first && !second) return "???"; std::string out; if(first) { out += KeyName(first); if(second)out += " or "; } if(second) { out += KeyName(second); } return out; }
TEST(WbSchemaTests, AddSubSchemaToNonExistentSchema) { TestSetup test; const bool addToNonExistentSchemaResult = test.parentSchema.AddSubSchemaToSchema( newSchema, KeyName( "NonExistentSchemaName" ), WbSchemaElement::Multiplicity::One ); EXPECT_FALSE(addToNonExistentSchemaResult) << "Adding to a non-existent schema fails"; EXPECT_EQ( 1 , test.parentSchema.GetNumSubSchemas() ) << "No sub-schema added to the top-level one"; }
void C_NameKeys (char *str, int first, int second) { int c = 0; *str = 0; if (first) { c++; strcpy (str, KeyName (first)); if (second) strcat (str, " or "); } if (second) { c++; strcat (str, KeyName (second)); } if (!c) *str = '\0'; }
void CommandLineExe::ExtractKeyData() { Stroka Name; for(map<Stroka, KeyData>::iterator iter = Params.begin(); iter != Params.end(); iter++) iter->second.SetVal("", 0); for(vector<Stroka>::iterator iter = Arguments.begin(); iter != Arguments.end(); iter++) { if(!KeyName(iter->c_str(), Name)) ArgumentsExtra.push_back(*iter); else Params[Name].SetVal(&(iter->c_str()[2]), 1); } }
void CompatModifier::init(ControllerMessageDescriptor& desc) { log_tmp("CompatModifier"); #if 0 // have a dpad, but no dpad axis if (!desc.abs().has(AbsName("gamepad.dpad_x")) && !desc.abs().has(AbsName("gamepad.dpad_y")) && desc.key().has(KeyName("gamepad.dpad_up")) && desc.key().has(KeyName("gamepad.dpad_down")) && desc.key().has(KeyName("gamepad.dpad_left")) && desc.key().has(KeyName("gamepad.dpad_right"))) { log_tmp("CompatModifier: DPAD"); m_dpad_x = desc.abs().put("dpad_x"); m_dpad_y = desc.abs().put("dpad_y"); m_dpad_up = desc.key().get("du"); m_dpad_down = desc.key().get("dd"); m_dpad_left = desc.key().get("dl"); m_dpad_right = desc.key().get("dr"); m_dpad = true; } // make a rudder out of both trigger if (!desc.abs().has("trigger") && desc.abs().has("lt") && desc.abs().has("rt")) { m_abs_trigger = desc.abs().put("trigger"); m_lt = desc.abs().get("lt"); m_rt = desc.abs().get("rt"); m_trigger = true; } #endif }
void config_key(int pad, int key) { bool captured = false; u32 key_pressed = 0; // save the joystick states UpdateJoysticks(); while (!captured) { vector<JoystickInfo*>::iterator itjoy; if (PollX11KeyboardMouseEvent(key_pressed)) { // special case for keyboard/mouse to handle multiple keys // Note: key_pressed == 0 when ESC is hit to abort the capture if (key_pressed > 0) set_keyboad_key(pad, key_pressed, key); captured = true; break; } SDL_JoystickUpdate(); itjoy = s_vjoysticks.begin(); while ((itjoy != s_vjoysticks.end()) && (!captured)) { if ((*itjoy)->PollButtons(key_pressed)) { set_key(pad, key, key_pressed); captured = true; break; } if ((*itjoy)->PollAxes(key_pressed)) { set_key(pad, key, key_pressed); captured = true; break; } if ((*itjoy)->PollHats(key_pressed)) { set_key(pad, key, key_pressed); captured = true; break; } itjoy++; } } PAD_LOG("%s\n", KeyName(pad, key).c_str()); }
static const char *ConfigKeyName(int keynum) { const char *name = KeyName(keynum); if (name[1] == 0) // Make sure given name is config-safe { if (name[0] == '[') return "LeftBracket"; else if (name[0] == ']') return "RightBracket"; else if (name[0] == '=') return "Equals"; else if (strcmp (name, "kp=") == 0) return "KP-Equals"; } return name; }
StatisticsCollector::TestCase StatisticsCollector::SetTestCase(const char *name, const char *mode, int threads) { string KeyName(name); switch (SortMode) { case ByThreads: KeyName += Format("_%02d_%s", threads, mode); break; default: case ByAlg: KeyName += Format("_%s_%02d", mode, threads); break; } CurrentKey = Statistics[KeyName]; if(!CurrentKey) { CurrentKey = new StatisticResults; CurrentKey->Mode = mode; CurrentKey->Name = name; CurrentKey->Threads = threads; CurrentKey->Results.reserve(RoundTitles.size()); Statistics[KeyName] = CurrentKey; } return TestCase(CurrentKey); }
TEST(WbConfigTests, SharedData) { WbSchema schema( KeyName( "testSchema" ) ); WbConfig config( schema, QFileInfo() ); const KeyName testKeyName ( "keyName" ); const KeyValue testKeyValue( KeyValue::from( "keyValue" ) ); config.SetKeyValue( testKeyName, testKeyValue ); EXPECT_EQ( testKeyValue , config.GetKeyValue( testKeyName ) ) << "Retrieving a value we just set works"; WbConfig copiedConfig( config ); EXPECT_EQ( testKeyValue , copiedConfig.GetKeyValue( testKeyName ) ) << "Retrieving a value from a copy of the config works"; const KeyValue testDifferentKeyValue( KeyValue::from( "testDifferentKeyValue" ) ); config.SetKeyValue( testKeyName, testDifferentKeyValue ); EXPECT_EQ(testDifferentKeyValue , copiedConfig.GetKeyValue( testKeyName )) << "After changing the value in the original config, the change is reflected in the copied config"; }
Xbox360DefaultNames::Xbox360DefaultNames(ControllerMessageDescriptor& desc) : btn_a(-1), btn_b(-1), btn_x(-1), btn_y(-1), btn_start(-1), btn_guide(-1), btn_back(-1), btn_thumb_l(-1), btn_thumb_r(-1), btn_lb(-1), btn_rb(-1), btn_lt(-1), btn_rt(-1), dpad_up(-1), dpad_down(-1), dpad_left(-1), dpad_right(-1), abs_x1(-1), abs_y1(-1), abs_x2(-1), abs_y2(-1), abs_lt(-1), abs_rt(-1), abs_a(-1), abs_b(-1), abs_x(-1), abs_y(-1), abs_black(-1), abs_white(-1) { #if 0 else if (str == "trigger" || str == "z" || str == "rudder") return XBOX_AXIS_TRIGGER; #endif btn_a = desc.key().put(KeyName("xbox.a")); btn_b = desc.key().put(KeyName("xbox.b")); btn_x = desc.key().put(KeyName("xbox.x")); btn_y = desc.key().put(KeyName("xbox.y")); btn_start = desc.key().put(KeyName("xbox.start")); btn_guide = desc.key().put(KeyName("xbox.guide")); btn_back = desc.key().put(KeyName("xbox.back")); btn_lb = desc.key().put(KeyName("xbox.lb")); btn_rb = desc.key().put(KeyName("xbox.rb")); btn_lt = desc.key().put(KeyName("xbox.lt")); btn_rt = desc.key().put(KeyName("xbox.rt")); btn_thumb_l = desc.key().put(KeyName("xbox.thumb_l")); btn_thumb_r = desc.key().put(KeyName("xbox.thumb_r")); dpad_up = desc.key().put(KeyName("xbox.dpad_up")); dpad_down = desc.key().put(KeyName("xbox.dpad_down")); dpad_left = desc.key().put(KeyName("xbox.dpad_left")); dpad_right = desc.key().put(KeyName("xbox.dpad_right")); abs_x1 = desc.abs().put(AbsName("xbox.x1")); abs_y1 = desc.abs().put(AbsName("xbox.y1")); abs_x2 = desc.abs().put(AbsName("xbox.x2")); abs_y2 = desc.abs().put(AbsName("xbox.y2")); abs_lt = desc.abs().put(AbsName("xbox.lt")); abs_rt = desc.abs().put(AbsName("xbox.rt")); abs_a = desc.abs().put(AbsName("xbox.a")); abs_b = desc.abs().put(AbsName("xbox.b")); abs_x = desc.abs().put(AbsName("xbox.x")); abs_y = desc.abs().put(AbsName("xbox.y")); abs_black = desc.abs().put(AbsName("xbox.black")); abs_white = desc.abs().put(AbsName("xbox.white")); }
/*---------------------------------------------------------------------- TtaListShortcuts Produces in a file a human-readable the list of current shortcuts. ----------------------------------------------------------------------*/ void TtaListShortcuts (Document doc, FILE *fileDescriptor) { KEY *next, *ptr; char sk1[10]; const char *s, *k1, *k2; int i; s = TtaGetEnvString ("ACCESSKEY_MOD"); k1 = &sk1[0]; k2 = k1; if (doc) { /* display current access keys table */ next = DocAccessKey[doc - 1]; if (next) fprintf (fileDescriptor, "Access keys\n"); while (next) { /* display the access key */ k1 = KeyName (next->K_EntryCode); fprintf (fileDescriptor, " %s %s\n", s, k1); next = next->K_Other; } fprintf (fileDescriptor, "\nShortcuts\n"); i = 0; while (i < 6) { if (i == 0) { next = Automata_SHIFT; s = "Shift "; } else if (i == 1) { next = Automata_normal; s = ""; } else if (i == 2) { next = Automata_ALT; s = "Shift Alt "; } else if (i == 3) { next = Automata_alt; s = "Alt "; } else if (i == 4) { next = Automata_CTRL; s = "Shift Ctrl "; } else { next = Automata_ctrl; s = "Ctrl "; } while (next) { strcpy (sk1, KeyName (next->K_EntryCode)); ptr = next->K_Next; if (ptr == NULL) { /* display the shortcut */ if (MenuActionList[next->K_Command].ActionName) fprintf (fileDescriptor, " %s%s -> %s\n", s, sk1, MenuActionList[next->K_Command].ActionName); } else /* two levels */ while (ptr) { /* display the shortcut sequence */ if (MenuActionList[ptr->K_Command].ActionName) { k2 = KeyName (ptr->K_EntryCode); fprintf (fileDescriptor, " %s%s %s%s -> %s\n", s, sk1, s, k2, MenuActionList[ptr->K_Command].ActionName); } ptr = ptr->K_Other; } next = next->K_Other; } i++; } } }
WiiNames::WiiNames(ControllerMessageDescriptor& desc) : plus(-1), home(-1), minus(-1), a(-1), b(-1), btn1(-1), btn2(-1), dpad_up(-1), dpad_down(-1), dpad_left(-1), dpad_right(-1), acc_x(-1), acc_y(-1), acc_z(-1), ir1_x(-1), ir1_y(-1), ir1_size(-1), ir2_x(-1), ir2_y(-1), ir2_size(-1), ir3_x(-1), ir3_y(-1), ir3_size(-1), ir4_x(-1), ir4_y(-1), ir4_size(-1), nunchuk_x(-1), nunchuk_y(-1), nunchuk_c(-1), nunchuk_z(-1), nunchuk_acc_x(-1), nunchuk_acc_y(-1), nunchuk_acc_z(-1) { minus = desc.key().put(KeyName("wiimote.minus")); home = desc.key().put(KeyName("wiimote.home")); plus = desc.key().put(KeyName("wiimote.plus")); a = desc.key().put(KeyName("wiimote.a")); b = desc.key().put(KeyName("wiimote.b")); btn1 = desc.key().put(KeyName("wiimote.1")); btn2 = desc.key().put(KeyName("wiimote.2")); dpad_up = desc.key().put(KeyName("wiimote.dpad_up")); dpad_down = desc.key().put(KeyName("wiimote.dpad_down")); dpad_left = desc.key().put(KeyName("wiimote.dpad_left")); dpad_right = desc.key().put(KeyName("wiimote.dpad_right")); acc_x = desc.abs().put(AbsName("wiimote.acc_x")); acc_y = desc.abs().put(AbsName("wiimote.acc_y")); acc_z = desc.abs().put(AbsName("wiimote.acc_z")); ir1_x = desc.abs().put(AbsName("wiimote.ir1_x")); ir1_y = desc.abs().put(AbsName("wiimote.ir1_y")); ir1_size = desc.abs().put(AbsName("wiimote.ir1_size")); ir2_x = desc.abs().put(AbsName("wiimote.ir2_x")); ir2_y = desc.abs().put(AbsName("wiimote.ir2_y")); ir2_size = desc.abs().put(AbsName("wiimote.ir2_size")); ir3_x = desc.abs().put(AbsName("wiimote.ir3_x")); ir3_y = desc.abs().put(AbsName("wiimote.ir3_y")); ir3_size = desc.abs().put(AbsName("wiimote.ir3_size")); ir4_x = desc.abs().put(AbsName("wiimote.ir4_x")); ir4_y = desc.abs().put(AbsName("wiimote.ir4_y")); ir4_size = desc.abs().put(AbsName("wiimote.ir4_size")); nunchuk_x = desc.abs().put(AbsName("nunchuk.x1")); nunchuk_y = desc.abs().put(AbsName("nunchuk.y1")); nunchuk_c = desc.key().put(KeyName("nunchuk.c")); nunchuk_z = desc.key().put(KeyName("nunchuk.z")); nunchuk_acc_x = desc.abs().put(AbsName("nunchuk.acc_x")); nunchuk_acc_y = desc.abs().put(AbsName("nunchuk.acc_x")); nunchuk_acc_z = desc.abs().put(AbsName("nunchuk.acc_y")); }
HamaCruxNames::HamaCruxNames(ControllerMessageDescriptor& desc) : crouch(desc.key().put(KeyName("hama-crux.crouch"))), run(desc.key().put(KeyName("hama-crux.run"))), talk(desc.key().put(KeyName("hama-crux.talk"))), esc(desc.key().put(KeyName("hama-crux.escape"))), pause(desc.key().put(KeyName("hama-crux.pause"))), option(desc.key().put(KeyName("hama-crux.option"))), quickload(desc.key().put(KeyName("hama-crux.quickload"))), quicksave(desc.key().put(KeyName("hama-crux.quicksave"))), print(desc.key().put(KeyName("hama-crux.print"))), n1(desc.key().put(KeyName("hama-crux.n1"))), n2(desc.key().put(KeyName("hama-crux.n2"))), n3(desc.key().put(KeyName("hama-crux.n3"))), n4(desc.key().put(KeyName("hama-crux.n4"))), n5(desc.key().put(KeyName("hama-crux.n5"))), n6(desc.key().put(KeyName("hama-crux.n6"))), n7(desc.key().put(KeyName("hama-crux.n7"))), n8(desc.key().put(KeyName("hama-crux.n8"))), n9(desc.key().put(KeyName("hama-crux.n9"))), n10(desc.key().put(KeyName("hama-crux.n10"))), n11(desc.key().put(KeyName("hama-crux.n11"))), up(desc.key().put(KeyName("hama-crux.up"))), down(desc.key().put(KeyName("hama-crux.down"))), left(desc.key().put(KeyName("hama-crux.left"))), right(desc.key().put(KeyName("hama-crux.right"))), q(desc.key().put(KeyName("hama-crux.q"))), e(desc.key().put(KeyName("hama-crux.e"))), c1(desc.key().put(KeyName("hama-crux.c1"))), tab(desc.key().put(KeyName("hama-crux.tab"))), c2(desc.key().put(KeyName("hama-crux.c2"))), c3(desc.key().put(KeyName("hama-crux.c3"))), c4(desc.key().put(KeyName("hama-crux.c4"))), reload(desc.key().put(KeyName("hama-crux.reload"))), use(desc.key().put(KeyName("hama-crux.use"))), c8(desc.key().put(KeyName("hama-crux.c8"))), p2(desc.key().put(KeyName("hama-crux.p2"))), n(desc.key().put(KeyName("hama-crux.n"))), c5(desc.key().put(KeyName("hama-crux.c5"))), c6(desc.key().put(KeyName("hama-crux.c6"))), c7(desc.key().put(KeyName("hama-crux.c7"))), p1(desc.key().put(KeyName("hama-crux.p1"))), space(desc.key().put(KeyName("hama-crux.space"))) { }
Collection RobotsCollection() { return Collection( KeyName( "robots" ), KeyName( "robot" ) ); }
EXPORT_C_(void) PADupdate(int pad) { // Poll keyboard. PollForKeyboardInput(pad); // joystick info SDL_JoystickUpdate(); for (int i = 0; i < MAX_KEYS; i++) { int cpad = PadEnum[pad][0]; if (JoystickIdWithinBounds(key_to_joystick_id(cpad, i))) { JoystickInfo* pjoy = s_vjoysticks[key_to_joystick_id(cpad, i)]; int pad = (pjoy)->GetPAD(); switch (type_of_key(cpad, i)) { case PAD_JOYBUTTONS: { int value = SDL_JoystickGetButton((pjoy)->GetJoy(), key_to_button(cpad, i)); if (value) clear_bit(status[pad], i); // released else set_bit(status[pad], i); // pressed break; } case PAD_HAT: { int value = SDL_JoystickGetHat((pjoy)->GetJoy(), key_to_axis(cpad, i)); if (key_to_hat_dir(cpad, i) == value) { clear_bit(status[pad], i); //PAD_LOG("Registered %s\n", HatName(value), i); //PAD_LOG("%s\n", KeyName(cpad, i).c_str()); } else { set_bit(status[pad], i); } break; } case PAD_POV: { int value = pjoy->GetAxisFromKey(cpad, i); PAD_LOG("%s: %d (%d)\n", KeyName(cpad, i).c_str(), value, key_to_pov_sign(cpad, i)); if (key_to_pov_sign(cpad, i) && (value < -2048)) { //PAD_LOG("%s Released+.\n", KeyName(cpad, i).c_str()); clear_bit(status[pad], i); } else if (!key_to_pov_sign(cpad, i) && (value > 2048)) { //PAD_LOG("%s Released-\n", KeyName(cpad, i).c_str()); clear_bit(status[pad], i); } else { //PAD_LOG("%s Pressed.\n", KeyName(cpad, i).c_str()); set_bit(status[pad], i); } break; } case PAD_JOYSTICK: { int value = pjoy->GetAxisFromKey(cpad, i); switch (i) { case PAD_LX: case PAD_LY: case PAD_RX: case PAD_RY: if (abs(value) > (pjoy)->GetDeadzone(value)) Analog::ConfigurePad(pad, i, value); else Analog::ResetPad(pad, i); break; } break; } default: break; } } } }