Пример #1
0
        public static OuyaController getControllerByDeviceId(int deviceId)
        {
            InitJNI();

            if (_jcOuyaController == IntPtr.Zero)
            {
                Log.Error(LOG_TAG, "_jcOuyaController is not initialized");
                return(null);
            }
            if (_jmGetControllerByDeviceId == IntPtr.Zero)
            {
                Log.Error(LOG_TAG, "_jmGetControllerByDeviceId is not initialized");
                return(null);
            }
            IntPtr result = JNIEnv.CallStaticObjectMethod(_jcOuyaController, _jmGetControllerByDeviceId, new JValue(deviceId));

            if (result == IntPtr.Zero)
            {
                Log.Error(LOG_TAG, "Failed to get OuyaController");
                return(null);
            }
            OuyaController retVal = new OuyaController();

            retVal.Instance = result;
            return(retVal);
        }
 public static OuyaController getControllerByDeviceId(int deviceId)
 {
     if (_jcOuyaController == IntPtr.Zero)
     {
         Log.Error(LOG_TAG, "_jcOuyaController is not initialized");
         return null;
     }
     if (_jmGetControllerByDeviceId == IntPtr.Zero)
     {
         Log.Error(LOG_TAG, "_jmGetControllerByDeviceId is not initialized");
         return null;
     }
     IntPtr result = JNIEnv.CallStaticObjectMethod(_jcOuyaController, _jmGetControllerByDeviceId, new JValue(deviceId));
     if (result == IntPtr.Zero)
     {
         Log.Error(LOG_TAG, "Failed to get OuyaController");
         return null;
     }
     OuyaController retVal = new OuyaController();
     retVal.Instance = result;
     return retVal;
 }