/// <summary> /// 対応するjoystick deviceを生成して返す。 /// </summary> /// <param name="device_index"></param> /// <returns></returns> /// <remarks> /// 最初のgetDeviceの呼び出し時点で接続されていない /// deviceについては認識できナー /// </remarks> public IKeyInput getDevice(int device_index) { if (device_index < 0 || device_index >= countJoyStick()) { return(new KeyInputNullDevice()); // 繋がってないのでnull deviceを代入 } if (devices[device_index] == null) { // 未生成っぽいので生成する IntPtr j = SDL.SDL_JoystickOpen(device_index); if (j == IntPtr.Zero) // open失敗しちょる { devices[device_index] = new KeyInputNullDevice(); } else { devices[device_index] = new JoyStickImp(j); } } else { // 生成済みならそれを返せば? } return(devices[device_index]); }
/// <summary> /// 対応するjoystick deviceを生成して返す。 /// </summary> /// <param name="device_index"></param> /// <returns></returns> /// <remarks> /// 最初のgetDeviceの呼び出し時点で接続されていない /// deviceについては認識できナー /// </remarks> public IKeyInput getDevice(int device_index) { if (device_index<0 || device_index >= countJoyStick()){ return new KeyInputNullDevice(); // 繋がってないのでnull deviceを代入 } if (devices[device_index] == null){ // 未生成っぽいので生成する IntPtr j = SDL.SDL_JoystickOpen(device_index); if (j == IntPtr.Zero) // open失敗しちょる devices[device_index] = new KeyInputNullDevice(); else devices[device_index] = new JoyStickImp(j); } else { // 生成済みならそれを返せば? } return devices[device_index]; }