Преглед изворни кода

Fixed applications that integrate Qt with SDL joystick support

Sam Lantinga пре 1 месец
родитељ
комит
3ed61f203e

+ 4 - 4
android-project/app/src/main/java/org/libsdl/app/HIDDeviceManager.java

@@ -25,14 +25,14 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 
-class HIDDeviceManager {
+public class HIDDeviceManager {
     private static final String TAG = "hidapi";
     private static final String ACTION_USB_PERMISSION = "org.libsdl.app.USB_PERMISSION";
 
     private static HIDDeviceManager sManager;
     private static int sManagerRefCount = 0;
 
-    static HIDDeviceManager acquire(Context context) {
+    static public HIDDeviceManager acquire(Context context) {
         if (sManagerRefCount == 0) {
             sManager = new HIDDeviceManager(context);
         }
@@ -40,7 +40,7 @@ class HIDDeviceManager {
         return sManager;
     }
 
-    static void release(HIDDeviceManager manager) {
+    static public void release(HIDDeviceManager manager) {
         if (manager == sManager) {
             --sManagerRefCount;
             if (sManagerRefCount == 0) {
@@ -540,7 +540,7 @@ class HIDDeviceManager {
         }
     }
 
-    void setFrozen(boolean frozen) {
+    public void setFrozen(boolean frozen) {
         synchronized (this) {
             for (HIDDevice device : mDevicesById.values()) {
                 device.setFrozen(frozen);

+ 5 - 5
android-project/app/src/main/java/org/libsdl/app/SDL.java

@@ -8,18 +8,18 @@ import java.lang.reflect.Method;
 /**
     SDL library initialization
 */
-class SDL {
+public class SDL {
 
     // This function should be called first and sets up the native code
     // so it can call into the Java classes
-    static void setupJNI() {
+    static public void setupJNI() {
         SDLActivity.nativeSetupJNI();
         SDLAudioManager.nativeSetupJNI();
         SDLControllerManager.nativeSetupJNI();
     }
 
     // This function should be called each time the activity is started
-    static void initialize() {
+    static public void initialize() {
         setContext(null);
 
         SDLActivity.initialize();
@@ -28,12 +28,12 @@ class SDL {
     }
 
     // This function stores the current activity (SDL or not)
-    static void setContext(Context context) {
+    static public void setContext(Context context) {
         SDLAudioManager.setContext(context);
         mContext = context;
     }
 
-    static Context getContext() {
+    static public Context getContext() {
         return mContext;
     }
 

+ 5 - 5
android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java

@@ -17,7 +17,7 @@ import android.view.MotionEvent;
 import android.view.View;
 
 
-class SDLControllerManager
+public class SDLControllerManager
 {
 
     static native int nativeSetupJNI();
@@ -29,8 +29,8 @@ class SDLControllerManager
     static native void nativeRemoveJoystick(int device_id);
     static native void nativeAddHaptic(int device_id, String name);
     static native void nativeRemoveHaptic(int device_id);
-    static native boolean onNativePadDown(int device_id, int keycode);
-    static native boolean onNativePadUp(int device_id, int keycode);
+    static public native boolean onNativePadDown(int device_id, int keycode);
+    static public native boolean onNativePadUp(int device_id, int keycode);
     static native void onNativeJoy(int device_id, int axis,
                                           float value);
     static native void onNativeHat(int device_id, int hat_id,
@@ -62,7 +62,7 @@ class SDLControllerManager
     }
 
     // Joystick glue code, just a series of stubs that redirect to the SDLJoystickHandler instance
-    static boolean handleJoystickMotionEvent(MotionEvent event) {
+    static public boolean handleJoystickMotionEvent(MotionEvent event) {
         return mJoystickHandler.handleMotionEvent(event);
     }
 
@@ -103,7 +103,7 @@ class SDLControllerManager
     }
 
     // Check if a given device is considered a possible SDL joystick
-    static boolean isDeviceSDLJoystick(int deviceId) {
+    static public boolean isDeviceSDLJoystick(int deviceId) {
         InputDevice device = InputDevice.getDevice(deviceId);
         // We cannot use InputDevice.isVirtual before API 16, so let's accept
         // only nonnegative device ids (VIRTUAL_KEYBOARD equals -1)