static void mouse_button_callback(GLFWwindow* window, int button, int action, int mods) { Slot* slot = glfwGetWindowUserPointer(window); printf("%08x to %i at %0.3f: Mouse button %i (%s) (with%s) was %s\n", counter++, slot->number, glfwGetTime(), button, get_button_name(button), get_mods_name(mods), get_action_name(action)); }
static void mouse_button_callback(GLFWwindow* window, int button, int action) { const char* name = get_button_name(button); printf("%08x at %0.3f: Mouse button %i", counter++, glfwGetTime(), button); if (name) printf(" (%s) was %s\n", name, get_action_name(action)); else printf(" was %s\n", get_action_name(action)); }
void Joystick::print_event_info() { if (Debug==0) return; if (m_ev.type==1) { //printf("time=%lu; Button #%d = %d\n", m_ev.time, m_ev.number, m_ev.value ); std::string button_name = get_button_name( m_ev.number ); if (m_ev.value==1) printf("time=%ul; Button %d %s down\n", m_ev.time, m_ev.number, button_name.c_str() ); else printf("time=%ul; Button %d %s up\n", m_ev.time, m_ev.number, button_name.c_str() ); } else if (m_ev.type==2) { if (m_ev.number==25) return; std::string axis_name = get_axis_name( m_ev.number ); printf("time=%ul; Axis %d %s = %d\n", m_ev.time, m_ev.number, axis_name.c_str(), m_ev.value ); } else printf("time=%ul; value=%d; type=%x; number=%d\n", m_ev.time, m_ev.value, m_ev.type, m_ev.number ); }
void JoystickMenu::refresh_menu_item(Controller::Control id) { ItemControlField* itemcf = dynamic_cast<ItemControlField*>(&get_item_by_id(static_cast<int>(id))); if (!itemcf) { return; } int button = g_config->joystick_config.reversemap_joybutton(id); int axis = g_config->joystick_config.reversemap_joyaxis(id); int hat_dir = g_config->joystick_config.reversemap_joyhat(id); if (button != -1) { itemcf->change_input(get_button_name(button)); } else if (axis != 0) { std::ostringstream name; name << "Axis "; if (axis < 0) name << "-"; else name << "+"; if (abs(axis) == 1) name << "X"; else if (abs(axis) == 2) name << "Y"; else if (abs(axis) == 3) name << "X2"; else if (abs(axis) == 4) name << "Y2"; else name << abs(axis); itemcf->change_input(name.str()); } else if (hat_dir != -1) { std::string name; switch (hat_dir) { case SDL_HAT_UP: name = "Hat Up"; break; case SDL_HAT_DOWN: name = "Hat Down"; break; case SDL_HAT_LEFT: name = "Hat Left"; break; case SDL_HAT_RIGHT: name = "Hat Right"; break; default: name = "Unknown hat_dir"; break; } itemcf->change_input(name); } else { itemcf->change_input("None"); } }