void xSDL_JoystickEventState() { if (SDL_JoystickEventState(SDL_ENABLE) == -1) { fprintf(stderr, "Erreur d'initialisation de SDL : %s\n", TTF_GetError()); exit(EXIT_FAILURE); } }
static int l_joystick_init(lua_State *L) { if (SDL_Init(SDL_INIT_JOYSTICK) != 0) { luaL_error(L, "could not init joystick"); } /* Make SDL push events through the event system */ SDL_JoystickEventState(SDL_ENABLE); return 0; }
void EventsManager::deinitJoysticks() { SDL_JoystickEventState(SDL_DISABLE); for (Joysticks::iterator j = _joysticks.begin(); j != _joysticks.end(); ++j) delete *j; _joysticks.clear(); }
JoystickSingleton::JoystickSingleton(){ SDL_Init(SDL_INIT_JOYSTICK); if (SDL_NumJoysticks() == 0) return; js = SDL_JoystickOpen(0); // always use the first joystick SDL_JoystickEventState(SDL_QUERY); }
JNIEXPORT jint JNICALL Java_at_wisch_joystick_JoystickManager_disableJoystickEventPollingNative(JNIEnv *env, jclass){ int state = SDL_JoystickEventState(SDL_IGNORE); if (state != SDL_IGNORE) { throwException(env, SDL_GetError()); return -13; } return 0; }
void TXT_ConfigureJoystickAxis(txt_joystick_axis_t *joystick_axis, int using_button, txt_joystick_axis_callback_t callback) { // Open the joystick first. if (SDL_Init(SDL_INIT_JOYSTICK) < 0) { return; } joystick_axis->joystick = SDL_JoystickOpen(joystick_index); if (joystick_axis->joystick == NULL) { TXT_MessageBox(NULL, "Please configure a controller first!"); return; } SDL_JoystickEventState(SDL_ENABLE); // Build the prompt window. joystick_axis->config_window = TXT_NewWindow("Gamepad/Joystick calibration"); TXT_AddWidgets(joystick_axis->config_window, TXT_NewStrut(0, 1), joystick_axis->config_label = TXT_NewLabel(""), TXT_NewStrut(0, 1), NULL); TXT_SetWindowAction(joystick_axis->config_window, TXT_HORIZ_LEFT, NULL); TXT_SetWindowAction(joystick_axis->config_window, TXT_HORIZ_CENTER, TXT_NewWindowAbortAction(joystick_axis->config_window)); TXT_SetWindowAction(joystick_axis->config_window, TXT_HORIZ_RIGHT, NULL); TXT_SetWidgetAlign(joystick_axis->config_window, TXT_HORIZ_CENTER); if (using_button >= 0) { joystick_axis->config_stage = CONFIG_STAGE1; joystick_axis->config_button = using_button; IdentifyBadAxes(joystick_axis); } else { joystick_axis->config_stage = CONFIG_CENTER; } SetCalibrationLabel(joystick_axis); // Close the joystick and shut down joystick subsystem when the window // is closed. TXT_SignalConnect(joystick_axis->config_window, "closed", CalibrateWindowClosed, joystick_axis); TXT_SDL_SetEventCallback(EventCallback, joystick_axis); // When successfully calibrated, invoke this callback: joystick_axis->callback = callback; }
bool C_GamepadManager::Initialize() { // ジョイスティックが初期化されていない場合 if( SDL_WasInit( SDL_INIT_JOYSTICK ) == 0 ) { // ジョイスティックを初期化 SDL_InitSubSystem( SDL_INIT_JOYSTICK ); } // ゲームパッドの総数を取得 gamepadTotalNumber_ = SDL_NumJoysticks(); // ゲームパッドが接続されていない場合 if ( gamepadTotalNumber_ == 0 ) { std::cout << "[ C_GamepadManager::Initialize ] : ゲームパッドが接続されていません。" << std::endl; return true; } for ( int i = 0; i < gamepadTotalNumber_; ++i ) { // ゲームパッドの情報 S_GamepadData gamepadData; // ゲームパッドを開く gamepadData.pGamepad_ = SDL_JoystickOpen( i ); // ゲームパッドの取得に失敗した場合 if( gamepadData.pGamepad_ == nullptr ) { std::cout << "[ C_GamepadManager::Initialize ] : ゲームパッドを開くのに失敗しました。" << std::endl; std::cout << " エラー内容 : " << SDL_GetError() << std::endl; break; } // ゲームパッドの情報を追加 gamepadDatas_.push_back( gamepadData ); gamepadDatas_[i].name_ = SDL_JoystickName( gamepadDatas_[i].pGamepad_ ); // ゲームパッドの情報を出力 std::cout << "[ C_GamepadManager::Initialize ] : Name : " << gamepadDatas_[i].name_ << std::endl; std::cout << " AxesNumber : " << SDL_JoystickNumAxes( gamepadDatas_[i].pGamepad_ ) << std::endl; std::cout << " ButtonNumber : " << SDL_JoystickNumButtons( gamepadDatas_[i].pGamepad_ ) << std::endl; std::cout << " BallNumber : " << SDL_JoystickNumBalls( gamepadDatas_[i].pGamepad_ ) << std::endl; std::cout << " HatNumber : " << SDL_JoystickNumHats( gamepadDatas_[i].pGamepad_ ) << std::endl; } // イベントのポーリングを無効にする if ( SDL_JoystickEventState( SDL_IGNORE ) < 0 ) { std::cout << "[ C_JoystickManager::Initialize ] : イベントのポーリングの設定に失敗しました。" << std::endl; std::cout << " エラー内容 : " << SDL_GetError() << std::endl; } return true; }
int main(void) { if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) die("could not init SDL"); SDL_JoystickEventState(SDL_ENABLE); if(!open_joysticks()) die("could not initialize any joysticks"); Display * dpy = XOpenDisplay(NULL); if(!dpy) die("could not connect to X display"); int _; if(!XQueryExtension(dpy, "XTEST", &_, &_, &_)) die("XTEST extension is not supported by X server"); SDL_Event ev; int horz = 0; int vert = 0; for(;;) { for(int i = 0; i < 10; ++i) { while(SDL_PollEvent(&ev)) { if(ev.type == SDL_QUIT) quit(0); if(ev.type != SDL_JOYAXISMOTION) continue; int val = ev.jaxis.value; if(abs(val) < THRESHOLD) val = 0; if(ev.jaxis.axis % 2 == 0) horz = val; else vert = val; } usleep(1000); } // abs() the value passed to pow() since it can't handle a negative // with a non-int exponent, and then turn the result back into a // negative if needed int horz_px = (int)pow(abs(horz) * 0.0001, 2.7) * (horz >= 0 ? 1 : -1); int vert_px = (int)pow(abs(vert) * 0.0001, 2.7) * (vert >= 0 ? 1 : -1); if(horz_px != 0 || vert_px != 0) { //fprintf(stderr, "ev %d %d -> %d %d\n", horz, vert, horz_px, vert_px); XTestFakeRelativeMotionEvent(dpy, horz_px, vert_px, CurrentTime); XSync(dpy, False); } } quit(0); }
void Joystick::initJoystick () { // activa joystick if (SDL_NumJoysticks() >= 1) { joystick = SDL_JoystickOpen(0); SDL_JoystickEventState (SDL_ENABLE); } }
void input_joystick_shutdown(void) { if (input_joystick==NULL) return; SDL_JoystickEventState(SDL_IGNORE); SDL_JoystickClose(input_joystick); input_joystick=NULL; }
static void PromptWindowClosed(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(joystick)) { TXT_CAST_ARG(SDL_Joystick, joystick); SDL_JoystickClose(joystick); TXT_SDL_SetEventCallback(NULL, NULL); SDL_JoystickEventState(SDL_DISABLE); SDL_QuitSubSystem(SDL_INIT_JOYSTICK); }
InputController::InputController(WindowBase& window): window_(window), keyboard_(new Keyboard()) { SDL_JoystickEventState(SDL_ENABLE); for(uint8_t i = 0; i < SDL_NumJoysticks(); ++i) { joypads_.push_back(Joypad::create()); sdl_joysticks_.push_back(SDL_JoystickOpen(i)); } }
static void dojoysetup( struct machine *oric, Sint16 mode_a, Sint16 mode_b ) { Sint32 i; close_joysticks( oric ); for( i=0; i<6; i++ ) { joystate_a[i] = 0; joystate_b[i] = 0; } if( (!is_real_joystick( mode_a )) && (!is_real_joystick( mode_b )) ) return; if( !joysubinited ) { //dbg_printf( "Initialising joysubsystem" ); if( SDL_InitSubSystem( SDL_INIT_JOYSTICK ) != 0 ) return; //dbg_printf( "Success!" ); joysubinited = SDL_TRUE; } if( is_real_joystick( mode_a ) ) { oric->sdljoy_a = SDL_JoystickOpen( mode_a - JOYMODE_SDL0 ); //dbg_printf( "Joy0 = %p", oric->sdljoy_a ); SDL_JoystickEventState( SDL_TRUE ); } if( is_real_joystick( mode_b ) ) { if( mode_b == mode_a ) { oric->sdljoy_b = oric->sdljoy_a; } else { oric->sdljoy_b = SDL_JoystickOpen( mode_b - JOYMODE_SDL0 ); SDL_JoystickEventState( SDL_TRUE ); } } }
void Joysticks::uninit() { SDL_JoystickEventState(SDL_DISABLE); for(int i = 0, end = SDL_NumJoysticks(); i < end; ++i) SDL_JoystickClose(m_joystick[size_t(i)].first); m_joystick.clear(); SDL_QuitSubSystem(SDL_INIT_JOYSTICK); }
SE_input_joystick *SE_input_open(int joyid){ SE_input_joystick *joystick; SDL_JoystickEventState(SDL_ENABLE); joystick = SDL_JoystickOpen(joyid); return joystick; }
void ManejadorEntrada::inicializarJoysticks() { // Si un no hemos inicializado el subsistema joystick, lo haremos aqui if(SDL_WasInit(SDL_INIT_JOYSTICK) == 0) { SDL_InitSubSystem(SDL_INIT_JOYSTICK); } // Obtener el numero de Joystick, saltar init si no hay ninguno if(SDL_NumJoysticks() > 0) { for(int i = 0; i < SDL_NumJoysticks(); i++) { // Crear un nuevo Joystick SDL_Joystick* joy = SDL_JoystickOpen(i); // si el joystick abrió correctamente necesitamos poblar nuestros arrays if(SDL_JoystickOpen(i)) { // Empujar en el array a cerrar mas tarde ? vJoysticks.push_back(joy); // Crear un par de valores para los ejes, un vector para cada palo vJoystickValues.push_back(std::make_pair(new Vector2D(0,0),new Vector2D(0,0))); // Crear un array para contener los valores del boton std::vector<bool> tempButtons; // Llenar el array con un valor falso para cada boton for(int j = 0; j < SDL_JoystickNumButtons(joy); j++) { tempButtons.push_back(false); } // Colocar el array de botones dentro del array de estados de botones vButtonStates.push_back(tempButtons); } else { // if there was an error initialising a joystick we want to know about it // si hubo un error inicializando un joystick, nosotros queremos saber cual. std::cout << SDL_GetError(); } } // Activar los eventos del Joystick SDL_JoystickEventState(SDL_ENABLE); bJoysticksInicializados = true; std::cout << "Inicializado " << vJoysticks.size() << " joystick(s)"; } else { bJoysticksInicializados = false; } }
static void *sdl_input_init(void) { init_lut(); sdl_input_t *sdl = (sdl_input_t*)calloc(1, sizeof(*sdl)); if (!sdl) return NULL; #ifdef HAVE_DINPUT sdl->di = sdl_dinput_init(); if (!sdl->di) { free(sdl); RARCH_ERR("Failed to init SDL/DInput.\n"); return NULL; } #else if (SDL_Init(SDL_INIT_JOYSTICK) < 0) return NULL; SDL_JoystickEventState(SDL_IGNORE); sdl->num_joysticks = SDL_NumJoysticks(); for (unsigned i = 0; i < MAX_PLAYERS; i++) { if (g_settings.input.joypad_map[i] < 0) continue; unsigned port = g_settings.input.joypad_map[i]; if (sdl->num_joysticks <= port) continue; sdl->joysticks[i] = SDL_JoystickOpen(port); if (!sdl->joysticks[i]) { RARCH_ERR("Couldn't open SDL joystick #%u on SNES port %u\n", port, i + 1); free(sdl); SDL_QuitSubSystem(SDL_INIT_JOYSTICK); return NULL; } RARCH_LOG("Opened Joystick: %s (#%u) on port %u\n", SDL_JoystickName(port), port, i + 1); sdl->num_axes[i] = SDL_JoystickNumAxes(sdl->joysticks[i]); sdl->num_buttons[i] = SDL_JoystickNumButtons(sdl->joysticks[i]); sdl->num_hats[i] = SDL_JoystickNumHats(sdl->joysticks[i]); RARCH_LOG("Joypad has: %u axes, %u buttons, %u hats.\n", sdl->num_axes[i], sdl->num_buttons[i], sdl->num_hats[i]); } #endif sdl->use_keyboard = true; return sdl; }
// bk001130 - from cvs1.17 (mkv), removed from linux_glimp.c void IN_StartupJoystick( void ) { int i = 0; int total = 0; if (stick != NULL) SDL_JoystickClose(stick); stick = NULL; memset(&stick_state, '\0', sizeof (stick_state)); if( !in_joystick->integer ) { Com_Printf( "Joystick is not active.\n" ); return; } if (!SDL_WasInit(SDL_INIT_JOYSTICK)) { Com_Printf("Calling SDL_Init(SDL_INIT_JOYSTICK)...\n"); if (SDL_Init(SDL_INIT_JOYSTICK) == -1) { Com_Printf("SDL_Init(SDL_INIT_JOYSTICK) failed: %s\n", SDL_GetError()); return; } Com_Printf("SDL_Init(SDL_INIT_JOYSTICK) passed.\n"); } total = SDL_NumJoysticks(); Com_Printf("I see %d possible joysticks\n", total); for (i = 0; i < total; i++) Com_Printf("[%d] %s\n", i, SDL_JoystickName(i)); in_joystickNo = Cvar_Get( "in_joystickNo", "0", CVAR_ARCHIVE ); if( in_joystickNo->integer < 0 || in_joystickNo->integer >= total ) Cvar_Set( "in_joystickNo", "0" ); stick = SDL_JoystickOpen( in_joystickNo->integer ); if (stick == NULL) { Com_Printf( "No joystick opened.\n" ); return; } Com_Printf( "Joystick %d opened\n", in_joystickNo->integer ); Com_Printf( "Name: %s\n", SDL_JoystickName(in_joystickNo->integer) ); Com_Printf( "Axes: %d\n", SDL_JoystickNumAxes(stick) ); Com_Printf( "Hats: %d\n", SDL_JoystickNumHats(stick) ); Com_Printf( "Buttons: %d\n", SDL_JoystickNumButtons(stick) ); Com_Printf( "Balls: %d\n", SDL_JoystickNumBalls(stick) ); SDL_JoystickEventState(SDL_QUERY); /* Our work here is done. */ return; }
Apsis::InputEngine::InputEngine() { _bindings = new Apsis::KeyBindingRepository(); #ifndef NO_SDL // Enable the joystick SDL_Joystick *joystick; SDL_JoystickEventState(SDL_ENABLE); joystick = SDL_JoystickOpen(0); #endif }
void I_InitJoystick(void) { #ifdef ORIGCODE if (!usejoystick) { return; } if (SDL_Init(SDL_INIT_JOYSTICK) < 0) { return; } if (joystick_index < 0 || joystick_index >= SDL_NumJoysticks()) { printf("I_InitJoystick: Invalid joystick ID: %i\n", joystick_index); SDL_QuitSubSystem(SDL_INIT_JOYSTICK); return; } // Open the joystick joystick = SDL_JoystickOpen(joystick_index); if (joystick == NULL) { printf("I_InitJoystick: Failed to open joystick #%i\n", joystick_index); SDL_QuitSubSystem(SDL_INIT_JOYSTICK); return; } if (!IsValidAxis(joystick_x_axis) || !IsValidAxis(joystick_y_axis) || !IsValidAxis(joystick_strafe_axis)) { printf("I_InitJoystick: Invalid joystick axis for joystick #%i " "(run joystick setup again)\n", joystick_index); SDL_JoystickClose(joystick); joystick = NULL; SDL_QuitSubSystem(SDL_INIT_JOYSTICK); } SDL_JoystickEventState(SDL_ENABLE); // Initialized okay! printf("I_InitJoystick: %s\n", SDL_JoystickName(joystick_index)); I_AtExit(I_ShutdownJoystick, true); #endif }
int ui_joystick_init( void ) { int error, retval; #ifdef UI_SDL error = SDL_InitSubSystem( SDL_INIT_JOYSTICK ); #else /* Other UIs could handle joysticks by the SDL library */ error = SDL_Init(SDL_INIT_JOYSTICK|SDL_INIT_VIDEO); #endif if ( error ) { ui_error( UI_ERROR_ERROR, "failed to initialise joystick subsystem" ); return 0; } retval = SDL_NumJoysticks(); if( retval >= 2 ) { retval = 2; if( ( joystick2 = SDL_JoystickOpen( 1 ) ) == NULL ) { ui_error( UI_ERROR_ERROR, "failed to initialise joystick 2" ); return 0; } if( SDL_JoystickNumAxes( joystick2 ) < 2 || SDL_JoystickNumButtons( joystick2 ) < 1 ) { ui_error( UI_ERROR_ERROR, "sorry, joystick 2 is inadequate!" ); return 0; } } if( retval > 0 ) { if( ( joystick1 = SDL_JoystickOpen( 0 ) ) == NULL ) { ui_error( UI_ERROR_ERROR, "failed to initialise joystick 1" ); return 0; } if( SDL_JoystickNumAxes( joystick1 ) < 2 || SDL_JoystickNumButtons( joystick1 ) < 1 ) { ui_error( UI_ERROR_ERROR, "sorry, joystick 1 is inadequate!" ); return 0; } } SDL_JoystickEventState( SDL_ENABLE ); return retval; }
void InputHandler::initialiseJoysticks() { // if we haven't already initialised the joystick subystem, we will do it here if (SDL_WasInit(SDL_INIT_JOYSTICK) == 0) { SDL_InitSubSystem(SDL_INIT_JOYSTICK); } // get the number of joysticks, skip init if there aren't any if (SDL_NumJoysticks() > 0) { for (int i = 0; i < SDL_NumJoysticks(); i++) { // create a new joystick SDL_Joystick* joy = SDL_JoystickOpen(i); // if the joystick opened correctly we need to populate our arrays if (SDL_JoystickOpen(i)) { // push back into the array to be closed later m_joysticks.push_back(joy); // create a pair of values for the axes, a vector for each stick m_joystickValues.push_back(std::make_pair(new Vector2D(0, 0), new Vector2D(0, 0))); // create an array to hold the button values std::vector<bool> tempButtons; // fill the array with a false value for each button for (int j = 0; j < SDL_JoystickNumButtons(joy); j++) { tempButtons.push_back(false); } // push the button array into the button state array m_buttonStates.push_back(tempButtons); } else { // if there was an error initialising a joystick we want to know about it std::cout << SDL_GetError(); } } // enable joystick events SDL_JoystickEventState(SDL_ENABLE); m_bJoysticksInitialised = true; std::cout << "Initialised " << m_joysticks.size() << " joystick(s)"; } else { m_bJoysticksInitialised = false; } }
void init_system() { if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK)) { printf("error at sdl init!\n"); exit(0); } if(SDL_NumJoysticks() > 0) { SDL_JoystickEventState(SDL_ENABLE); joystick = SDL_JoystickOpen(0); } }
static PyObject* joy_autoinit (PyObject* self) { if (!SDL_WasInit (SDL_INIT_JOYSTICK)) { if (SDL_InitSubSystem (SDL_INIT_JOYSTICK)) { return PyInt_FromLong (0); } SDL_JoystickEventState (SDL_ENABLE); PyGame_RegisterQuit (joy_autoquit); } return PyInt_FromLong (1); }
/* * SDL.joystickEventState(index) * * Arguments: * state the state * * Returns: * The status or nil on failure * The error message */ static int l_joystickEventState(lua_State *L) { int state = luaL_checkinteger(L, 1); int ret; ret = SDL_JoystickEventState(state); if (ret < 0) return commonPushSDLError(L, 1); return commonPush(L, "i", ret); }
void SystemData::launchGame(GameData* game) { std::cout << "Attempting to launch game...\n"; //suspend SDL joystick events (these'll pile up even while something else is running) SDL_JoystickEventState(0); std::string command = mLaunchCommand; command = strreplace(command, "%ROM%", game->getBashPath()); std::cout << " " << command << "\n"; std::cout << "=====================================================\n"; system(command.c_str()); std::cout << "=====================================================\n"; std::cout << "...launch terminated!\n"; //re-enable SDL joystick events SDL_JoystickEventState(1); }
void SdlContext::_initJoysticks(Input &inputs) { // Init Joysticks for (int i = 0; i < AGE_JOYSTICK_MAX_NUMBER; ++i) { _joysticks[i].id = -1; _joysticks[i].handler = NULL; } SDL_JoystickEventState(SDL_ENABLE); for (int i = 0; i < SDL_NumJoysticks(); ++i) _addJoystick(inputs, i); }
//Registers, creates, and shows the Window!! bool WinCreate() { int init_flags = SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER; if (SDL_Init(init_flags) < 0) { return false; } if (TTF_Init() < 0) { return false; } SDL_InitSubSystem(SDL_INIT_JOYSTICK); SDL_EnableUNICODE(1); SDL_EnableKeyRepeat(500, OPTIONS["INPUT_DELAY"]); atexit(SDL_Quit); std::string version = string_format("Cataclysm: Dark Days Ahead - %s", getVersionString()); SDL_WM_SetCaption(version.c_str(), NULL); char center_string[] = "SDL_VIDEO_CENTERED=center"; // indirection needed to avoid a warning SDL_putenv(center_string); screen = SDL_SetVideoMode(WindowWidth, WindowHeight, 32, (SDL_SWSURFACE|SDL_DOUBLEBUF)); //SDL_SetColors(screen,windowsPalette,0,256); if (screen == NULL) return false; ClearScreen(); if(OPTIONS["HIDE_CURSOR"] != "show" && SDL_ShowCursor(-1)) SDL_ShowCursor(SDL_DISABLE); else SDL_ShowCursor(SDL_ENABLE); // Initialize joysticks. int numjoy = SDL_NumJoysticks(); if(numjoy > 1) { DebugLog() << "You have more than one gamepads/joysticks plugged in, only the first will be used.\n"; } if(numjoy >= 1) { joystick = SDL_JoystickOpen(0); } else { joystick = NULL; } SDL_JoystickEventState(SDL_ENABLE); return true; };
int initCtrl (){ if(!(SDL_Init(SDL_INIT_EVERYTHING))){ SDL_SetEventFilter(eventFilter); SDL_SetVideoMode(200, 200, 0, 0); // SDL_WM_GrabInput(SDL_GRAB_ON); // If gamepad mode specified, open gamepad if(ctrlmode == GAMEPAD){ int num_pads; // If more than one joystick attached, let user choose which one if((num_pads = SDL_NumJoysticks()) > 1){ sprintf(termbuf, "Select gamepad index (number from 0 to %d): ", (num_pads-1)); printmsg(); while((pad_index = fgetc(stdin)) == EOF); } if((pad = SDL_JoystickOpen(pad_index))){ sprintf(termbuf, "%s opened successfully.\n", SDL_JoystickName(pad_index)); printmsg(); // Set initial modes cur_move = MOV_STOP; cur_turn = TRN_NONE; cur_h_aim = AIM_H_STRGHT; cur_v_aim = AIM_V_STRGHT; cur_fire = FIRE_OFF; cur_l_strf = STRF_L_OFF; cur_r_strf = STRF_R_OFF; SDL_JoystickEventState(SDL_ENABLE); } else{ sprintf(termbuf, "Gamepad %s not opened successfully.\nReverting to keyboard control\n", SDL_JoystickName(pad_index)); printmsg(); ctrlmode = KEYBOARD; } } return -1; } return 0; }
int cJoystick :: Init( void ) { // if not enabled if( !pPreferences->m_joy_enabled ) { return 0; } int joy_count = SDL_NumJoysticks(); // no joystick available if( joy_count <= 0 ) { printf( "No joysticks available\n" ); pPreferences->m_joy_enabled = 0; return 0; } if( m_debug ) { printf( "Joysticks found : %d\n\n", joy_count ); } unsigned int default_joy = 0; // if default joy name is given if( !pPreferences->m_joy_name.empty() ) { vector<std::string> joy_names = Get_Names(); for( unsigned int i = 0; i < joy_names.size(); i++ ) { // found default joy if( joy_names[i].compare( pPreferences->m_joy_name ) == 0 ) { default_joy = i; break; } } } // setup SDL_JoystickEventState( SDL_ENABLE ); Stick_Open( default_joy ); if( m_debug ) { printf( "Joypad System Initialized\n" ); } return 1; }