Fixed bug in gamepad dpad processing, removed old unused trackball code, random 64-bit fixes
This commit is contained in:
@@ -856,6 +856,7 @@ if [ "$GooglePlayGameServicesId" = "n" -o -z "$GooglePlayGameServicesId" ] ; the
|
||||
GooglePlayGameServicesId=""
|
||||
grep 'google-play-services' project/local.properties > /dev/null && {
|
||||
$SEDI 's/.*google-play-services.*//g' project/local.properties
|
||||
rm -f project/libs/android-support-v4.jar
|
||||
}
|
||||
else
|
||||
for F in $JAVA_SRC_PATH/googleplaygameservices/*.java; do
|
||||
@@ -863,7 +864,6 @@ else
|
||||
echo Patching $F
|
||||
echo '// DO NOT EDIT THIS FILE - it is automatically generated, edit file under $JAVA_SRC_PATH dir' > project/src/$OUT
|
||||
cat $F | sed "s/^package .*;/package $AppFullName;/" >> project/src/$OUT
|
||||
rm -f project/libs/android-support-v4.jar
|
||||
done
|
||||
$SEDI "s/==GOOGLEPLAYGAMESERVICES_APP_ID==/$GooglePlayGameServicesId/g" project/res/values/strings.xml
|
||||
SDK_DIR=`grep '^sdk.dir' project/local.properties | sed 's/.*=//'`
|
||||
|
||||
@@ -80,7 +80,6 @@ class Globals
|
||||
public static boolean HorizontalOrientation = true;
|
||||
public static boolean ImmersiveMode = true;
|
||||
public static boolean DownloadToSdcard = true;
|
||||
public static boolean PhoneHasTrackball = false;
|
||||
public static boolean PhoneHasArrowKeys = false;
|
||||
public static boolean UseAccelerometerAsArrowKeys = false;
|
||||
public static boolean UseTouchscreenKeyboard = true;
|
||||
@@ -92,7 +91,6 @@ class Globals
|
||||
public static boolean FloatingScreenJoystick = false;
|
||||
public static int AccelerometerSensitivity = 2;
|
||||
public static int AccelerometerCenterPos = 2;
|
||||
public static int TrackballDampening = 0;
|
||||
public static int AudioBufferConfig = 0;
|
||||
public static boolean OptionalDataDownload[] = null;
|
||||
public static int LeftClickMethod = ForceRelativeMouseMode ? Mouse.LEFT_CLICK_WITH_TAP_OR_TIMEOUT : Mouse.LEFT_CLICK_NORMAL;
|
||||
|
||||
@@ -92,13 +92,13 @@ class Settings
|
||||
out.writeInt(SETTINGS_FILE_VERSION);
|
||||
out.writeBoolean(Globals.DownloadToSdcard);
|
||||
out.writeBoolean(Globals.PhoneHasArrowKeys);
|
||||
out.writeBoolean(Globals.PhoneHasTrackball);
|
||||
out.writeBoolean(false);
|
||||
out.writeBoolean(Globals.UseAccelerometerAsArrowKeys);
|
||||
out.writeBoolean(Globals.UseTouchscreenKeyboard);
|
||||
out.writeInt(Globals.TouchscreenKeyboardSize);
|
||||
out.writeInt(Globals.AccelerometerSensitivity);
|
||||
out.writeInt(Globals.AccelerometerCenterPos);
|
||||
out.writeInt(Globals.TrackballDampening);
|
||||
out.writeInt(0);
|
||||
out.writeInt(Globals.AudioBufferConfig);
|
||||
out.writeInt(Globals.TouchscreenKeyboardTheme);
|
||||
out.writeInt(Globals.RightClickMethod);
|
||||
@@ -274,13 +274,13 @@ class Settings
|
||||
throw new IOException();
|
||||
Globals.DownloadToSdcard = settingsFile.readBoolean();
|
||||
Globals.PhoneHasArrowKeys = settingsFile.readBoolean();
|
||||
Globals.PhoneHasTrackball = settingsFile.readBoolean();
|
||||
settingsFile.readBoolean();
|
||||
Globals.UseAccelerometerAsArrowKeys = settingsFile.readBoolean();
|
||||
Globals.UseTouchscreenKeyboard = settingsFile.readBoolean();
|
||||
Globals.TouchscreenKeyboardSize = settingsFile.readInt();
|
||||
Globals.AccelerometerSensitivity = settingsFile.readInt();
|
||||
Globals.AccelerometerCenterPos = settingsFile.readInt();
|
||||
Globals.TrackballDampening = settingsFile.readInt();
|
||||
settingsFile.readInt();
|
||||
Globals.AudioBufferConfig = settingsFile.readInt();
|
||||
Globals.TouchscreenKeyboardTheme = settingsFile.readInt();
|
||||
Globals.RightClickMethod = settingsFile.readInt();
|
||||
@@ -546,8 +546,6 @@ class Settings
|
||||
nativeSetVideoForceSoftwareMode();
|
||||
if( Globals.SwVideoMode && Globals.MultiThreadedVideo )
|
||||
nativeSetVideoMultithreaded();
|
||||
if( Globals.PhoneHasTrackball )
|
||||
nativeSetTrackballUsed();
|
||||
applyMouseEmulationOptions();
|
||||
nativeSetJoystickUsed( Globals.AppUsesThirdJoystick ? 3 : (Globals.AppUsesSecondJoystick ? 2 : (Globals.AppUsesJoystick ? 1 : 0)) );
|
||||
if( Globals.AppUsesAccelerometer )
|
||||
@@ -555,7 +553,6 @@ class Settings
|
||||
if( Globals.AppUsesMultitouch )
|
||||
nativeSetMultitouchUsed();
|
||||
nativeSetAccelerometerSettings(Globals.AccelerometerSensitivity, Globals.AccelerometerCenterPos);
|
||||
nativeSetTrackballDampening(Globals.TrackballDampening);
|
||||
if( Globals.UseTouchscreenKeyboard )
|
||||
{
|
||||
boolean screenKbReallyUsed = false;
|
||||
@@ -856,8 +853,6 @@ class Settings
|
||||
return true;
|
||||
}
|
||||
|
||||
private static native void nativeSetTrackballUsed();
|
||||
private static native void nativeSetTrackballDampening(int value);
|
||||
private static native void nativeSetAccelerometerSettings(int sensitivity, int centerPos);
|
||||
private static native void nativeSetMouseUsed(int RightClickMethod, int ShowScreenUnderFinger, int LeftClickMethod,
|
||||
int MoveMouseWithJoystick, int ClickMouseWithDpad, int MaxForce, int MaxRadius,
|
||||
|
||||
@@ -123,8 +123,6 @@ abstract class DifferentTouchInput
|
||||
Log.i("SDL", "Device board: " + android.os.Build.BOARD);
|
||||
if( android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH )
|
||||
{
|
||||
if( DetectCrappyDragonRiseDatexGamepad() )
|
||||
return CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance;
|
||||
//return IcsTouchInput.Holder.sInstance;
|
||||
return AutoDetectTouchInput.Holder.sInstance;
|
||||
}
|
||||
@@ -145,12 +143,6 @@ abstract class DifferentTouchInput
|
||||
}
|
||||
}
|
||||
}
|
||||
private static boolean DetectCrappyDragonRiseDatexGamepad()
|
||||
{
|
||||
if( CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance == null )
|
||||
return false;
|
||||
return CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad.Holder.sInstance.detect();
|
||||
}
|
||||
|
||||
private static class SingleTouchInput extends DifferentTouchInput
|
||||
{
|
||||
@@ -388,10 +380,6 @@ abstract class DifferentTouchInput
|
||||
// Joysticks are supported since Honeycomb, but I don't care about it, because very little devices have it
|
||||
if( (event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == InputDevice.SOURCE_CLASS_JOYSTICK )
|
||||
{
|
||||
DemoGLSurfaceView.nativeGamepadAnalogJoystickInput(
|
||||
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
|
||||
event.getAxisValue(MotionEvent.AXIS_Z), event.getAxisValue(MotionEvent.AXIS_RZ),
|
||||
event.getAxisValue(MotionEvent.AXIS_RTRIGGER), event.getAxisValue(MotionEvent.AXIS_LTRIGGER) );
|
||||
// event.getAxisValue(AXIS_HAT_X) and event.getAxisValue(AXIS_HAT_Y) are joystick arrow keys, on Nvidia Shield and some other joysticks
|
||||
if( event.getAxisValue(MotionEvent.AXIS_HAT_X) != hatX )
|
||||
{
|
||||
@@ -415,6 +403,11 @@ abstract class DifferentTouchInput
|
||||
else
|
||||
DemoGLSurfaceView.nativeKey(hatY < 0.0f ? KeyEvent.KEYCODE_DPAD_UP : KeyEvent.KEYCODE_DPAD_DOWN, 1, 0);
|
||||
}
|
||||
DemoGLSurfaceView.nativeGamepadAnalogJoystickInput(
|
||||
event.getAxisValue(MotionEvent.AXIS_X), event.getAxisValue(MotionEvent.AXIS_Y),
|
||||
event.getAxisValue(MotionEvent.AXIS_Z), event.getAxisValue(MotionEvent.AXIS_RZ),
|
||||
event.getAxisValue(MotionEvent.AXIS_RTRIGGER), event.getAxisValue(MotionEvent.AXIS_LTRIGGER),
|
||||
(hatX == 0.0f && hatY == 0.0f) ? 0 : 1 );
|
||||
return;
|
||||
}
|
||||
// Process mousewheel
|
||||
@@ -454,36 +447,6 @@ abstract class DifferentTouchInput
|
||||
super.process(event);
|
||||
}
|
||||
}
|
||||
private static class CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad extends IcsTouchInput
|
||||
{
|
||||
private static class Holder
|
||||
{
|
||||
private static final CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad sInstance = new CrappyDragonRiseDatexGamepadInputWhichNeedsItsOwnHandlerBecauseImTooCheapAndStupidToBuyProperGamepad();
|
||||
}
|
||||
public void processGenericEvent(final MotionEvent event)
|
||||
{
|
||||
super.processGenericEvent(event);
|
||||
}
|
||||
public boolean detect()
|
||||
{
|
||||
int[] devIds = InputDevice.getDeviceIds();
|
||||
for( int id : devIds )
|
||||
{
|
||||
InputDevice device = InputDevice.getDevice(id);
|
||||
if( device == null )
|
||||
continue;
|
||||
System.out.println("libSDL: input device ID " + id + " type " + device.getSources() + " name " + device.getName() );
|
||||
if( (device.getSources() & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD &&
|
||||
(device.getSources() & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK &&
|
||||
device.getName().indexOf("DragonRise Inc") == 0 )
|
||||
{
|
||||
System.out.println("libSDL: Detected crappy DragonRise gamepad, enabling special hack for it. Please press button labeled 'Analog', otherwise it won't work, because it's cheap and crappy");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private static class CrappyMtkTabletWithBrokenTouchDrivers extends IcsTouchInput
|
||||
{
|
||||
private static class Holder
|
||||
@@ -1073,7 +1036,7 @@ class DemoGLSurfaceView extends GLSurfaceView_SDL {
|
||||
public static native void nativeHardwareMouseDetected( int detected );
|
||||
public static native void nativeMouseButtonsPressed( int buttonId, int pressedState );
|
||||
public static native void nativeMouseWheel( int scrollX, int scrollY );
|
||||
public static native void nativeGamepadAnalogJoystickInput( float stick1x, float stick1y, float stick2x, float stick2y, float rtrigger, float ltrigger );
|
||||
public static native void nativeGamepadAnalogJoystickInput( float stick1x, float stick1y, float stick2x, float stick2y, float rtrigger, float ltrigger, int usingHat );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -445,6 +445,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK);
|
||||
SDL_EnableUNICODE(1);
|
||||
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||
SDL_Joystick * joysticks[6];
|
||||
for( i = 0; i < 6; i++ )
|
||||
joysticks[i] = SDL_JoystickOpen(i);
|
||||
@@ -746,6 +747,14 @@ int main(int argc, char* argv[])
|
||||
x_speed = 500.0 * sin(t * 0.37);
|
||||
y_speed = 500.0 * sin(t * 0.53);
|
||||
z_speed = 400.0 * sin(t * 0.21);
|
||||
if( SDL_GetKeyState(NULL)[SDLK_LEFT] )
|
||||
x_speed -= 100000 * dt;
|
||||
if( SDL_GetKeyState(NULL)[SDLK_RIGHT] )
|
||||
x_speed += 100000 * dt;
|
||||
if( SDL_GetKeyState(NULL)[SDLK_UP] )
|
||||
y_speed -= 100000 * dt;
|
||||
if( SDL_GetKeyState(NULL)[SDLK_DOWN] )
|
||||
y_speed += 100000 * dt;
|
||||
|
||||
ballfield_move(balls, x_speed, y_speed, z_speed);
|
||||
x_offs -= x_speed;
|
||||
|
||||
Submodule project/jni/application/commandergenius/commandergenius updated: 41f402916f...43060a5f49
@@ -2,7 +2,10 @@ LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
ifeq ($(filter armeabi-v7a-hard, $(APP_ABI)),) # Pre-compiled lib disabled for armhf ABI
|
||||
ifneq ($(TARGET_ARCH_ABI),armeabi-v7a-hard) # Pre-compiled lib disabled for armhf ABI
|
||||
ifneq ($(TARGET_ARCH_ABI),arm64-v8a) # Not supported yet
|
||||
ifneq ($(TARGET_ARCH_ABI),x86_64) # Not supported yet
|
||||
ifneq ($(TARGET_ARCH_ABI),mips64) # Not supported yet
|
||||
|
||||
LOCAL_MODULE := $(notdir $(LOCAL_PATH))
|
||||
|
||||
@@ -13,3 +16,6 @@ LOCAL_SRC_FILES := lib/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -2,7 +2,10 @@ LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
ifeq ($(filter armeabi-v7a-hard, $(APP_ABI)),) # Pre-compiled lib disabled for armhf ABI
|
||||
ifneq ($(TARGET_ARCH_ABI),armeabi-v7a-hard) # Pre-compiled lib disabled for armhf ABI
|
||||
ifneq ($(TARGET_ARCH_ABI),arm64-v8a) # Not supported yet
|
||||
ifneq ($(TARGET_ARCH_ABI),x86_64) # Not supported yet
|
||||
ifneq ($(TARGET_ARCH_ABI),mips64) # Not supported yet
|
||||
|
||||
LOCAL_MODULE := $(notdir $(LOCAL_PATH))
|
||||
|
||||
@@ -17,3 +20,6 @@ obj/local/$(TARGET_ARCH_ABI)/lib$(LOCAL_MODULE).a: $(LOCAL_PATH)/$(LOCAL_SRC_FIL
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -88,7 +88,6 @@ extern void SDL_ANDROID_PumpEvents()
|
||||
{
|
||||
static int oldMouseButtons = 0;
|
||||
SDL_Event ev;
|
||||
SDL_ANDROID_processAndroidTrackballDampening();
|
||||
SDL_ANDROID_processMoveMouseWithKeyboard();
|
||||
#if SDL_VERSION_ATLEAST(1,3,0)
|
||||
SDL_Window * window = SDL_GetFocusWindow();
|
||||
|
||||
@@ -71,7 +71,6 @@ extern void SDL_ANDROID_PumpEvents()
|
||||
{
|
||||
joystickEventsCount = 0;
|
||||
|
||||
SDL_ANDROID_processAndroidTrackballDampening();
|
||||
SDL_ANDROID_processMoveMouseWithKeyboard();
|
||||
};
|
||||
|
||||
|
||||
@@ -62,7 +62,6 @@ static inline SDL_scancode TranslateKey(int scancode)
|
||||
return SDL_android_keymap[scancode];
|
||||
}
|
||||
|
||||
static int isTrackballUsed = 0;
|
||||
int SDL_ANDROID_isMouseUsed = 0;
|
||||
|
||||
#define NORMALIZE_FLOAT_32767(X) (fminf(32767.0f, fmaxf(-32767.0f, (X) * 32767.0f)))
|
||||
@@ -92,8 +91,6 @@ int SDL_ANDROID_joysticksAmount = 0;
|
||||
static int SDL_ANDROID_isAccelerometerUsed = 0;
|
||||
static int isMultitouchUsed = 0;
|
||||
SDL_Joystick *SDL_ANDROID_CurrentJoysticks[JOY_GAMEPAD4+1];
|
||||
static int TrackballDampening = 0; // in milliseconds
|
||||
static Uint32 lastTrackballAction = 0;
|
||||
enum { TOUCH_PTR_UP = 0, TOUCH_PTR_MOUSE = 1, TOUCH_PTR_SCREENKB = 2 };
|
||||
static int touchPointers[MAX_MULTITOUCH_POINTERS] = {0};
|
||||
static int firstMousePointerId = -1, secondMousePointerId = -1;
|
||||
@@ -945,8 +942,6 @@ void SDL_ANDROID_WarpMouse(int x, int y)
|
||||
}
|
||||
};
|
||||
|
||||
static int processAndroidTrackball(int key, int action);
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint key, jint action, jint unicode )
|
||||
{
|
||||
@@ -956,9 +951,6 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
if( isTrackballUsed )
|
||||
if( processAndroidTrackball(key, action) )
|
||||
return 1;
|
||||
if( key == rightClickKey && rightClickMethod == RIGHT_CLICK_WITH_KEY )
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushMouseButton( action ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT );
|
||||
@@ -970,7 +962,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint
|
||||
return 1;
|
||||
}
|
||||
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL","nativeKey %d translated %d unicode %d", key, TranslateKey(key), unicode);
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL","nativeKey %d action %d translated %d unicode %d", key, action, TranslateKey(key), unicode);
|
||||
|
||||
if( TranslateKey(key) == SDLK_NO_REMAP || (TranslateKey(key) == SDLK_UNKNOWN && (unicode & 0xFF80) == 0) )
|
||||
return 0;
|
||||
@@ -1077,12 +1069,6 @@ JAVA_EXPORT_NAME(AccelerometerReader_nativeGyroscope) ( JNIEnv* env, jobject th
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetTrackballUsed) ( JNIEnv* env, jobject thiz)
|
||||
{
|
||||
isTrackballUsed = 1;
|
||||
}
|
||||
|
||||
static int getClickTimeout(int v)
|
||||
{
|
||||
switch(v)
|
||||
@@ -1330,15 +1316,10 @@ JAVA_EXPORT_NAME(Settings_nativeSetAccelerometerSettings) ( JNIEnv* env, jobjec
|
||||
accelerometerCenterPos = centerPos;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(Settings_nativeSetTrackballDampening) ( JNIEnv* env, jobject thiz, jint value)
|
||||
{
|
||||
TrackballDampening = (value * 200);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeGamepadAnalogJoystickInput) (JNIEnv* env, jobject thiz,
|
||||
jfloat stick1x, jfloat stick1y, jfloat stick2x, jfloat stick2y, jfloat rtrigger, jfloat ltrigger)
|
||||
jfloat stick1x, jfloat stick1y, jfloat stick2x, jfloat stick2y, jfloat rtrigger, jfloat ltrigger,
|
||||
jint usingHat)
|
||||
{
|
||||
if( SDL_ANDROID_CurrentJoysticks[JOY_GAMEPAD1] )
|
||||
{
|
||||
@@ -1349,7 +1330,7 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeGamepadAnalogJoystickInput) (JNIEnv* en
|
||||
SDL_ANDROID_MainThreadPushJoystickAxis(JOY_GAMEPAD1, 4, NORMALIZE_FLOAT_32767(ltrigger));
|
||||
SDL_ANDROID_MainThreadPushJoystickAxis(JOY_GAMEPAD1, 5, NORMALIZE_FLOAT_32767(rtrigger));
|
||||
}
|
||||
else
|
||||
else if( !usingHat )
|
||||
{
|
||||
// Translate to up/down/left/right
|
||||
if( stick1x < -0.5f )
|
||||
@@ -1395,128 +1376,6 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeGamepadAnalogJoystickInput) (JNIEnv* en
|
||||
}
|
||||
}
|
||||
|
||||
static int leftPressed = 0, rightPressed = 0, upPressed = 0, downPressed = 0;
|
||||
|
||||
int processAndroidTrackball(int key, int action)
|
||||
{
|
||||
SDL_keysym keysym;
|
||||
|
||||
if( ! action && (
|
||||
key == KEYCODE_DPAD_UP ||
|
||||
key == KEYCODE_DPAD_DOWN ||
|
||||
key == KEYCODE_DPAD_LEFT ||
|
||||
key == KEYCODE_DPAD_RIGHT ) )
|
||||
return 1;
|
||||
lastTrackballAction = SDL_GetTicks();
|
||||
|
||||
if( key == KEYCODE_DPAD_UP )
|
||||
{
|
||||
if( downPressed )
|
||||
{
|
||||
downPressed = 0;
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_DOWN), 0 );
|
||||
return 1;
|
||||
}
|
||||
if( !upPressed )
|
||||
{
|
||||
upPressed = 1;
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(key), 0 );
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( key == KEYCODE_DPAD_DOWN )
|
||||
{
|
||||
if( upPressed )
|
||||
{
|
||||
upPressed = 0;
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_UP), 0 );
|
||||
return 1;
|
||||
}
|
||||
if( !upPressed )
|
||||
{
|
||||
downPressed = 1;
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(key), 0 );
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( key == KEYCODE_DPAD_LEFT )
|
||||
{
|
||||
if( rightPressed )
|
||||
{
|
||||
rightPressed = 0;
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_RIGHT), 0 );
|
||||
return 1;
|
||||
}
|
||||
if( !leftPressed )
|
||||
{
|
||||
leftPressed = 1;
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(key), 0 );
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( key == KEYCODE_DPAD_RIGHT )
|
||||
{
|
||||
if( leftPressed )
|
||||
{
|
||||
leftPressed = 0;
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_LEFT), 0 );
|
||||
return 1;
|
||||
}
|
||||
if( !rightPressed )
|
||||
{
|
||||
rightPressed = 1;
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(key), 0 );
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_PRESSED, TranslateKey(key), 0 );
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SDL_ANDROID_processAndroidTrackballDampening()
|
||||
{
|
||||
if( !TrackballDampening )
|
||||
return;
|
||||
if( SDL_GetTicks() > TrackballDampening + lastTrackballAction )
|
||||
{
|
||||
if( upPressed )
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_UP), 0 );
|
||||
if( downPressed )
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_DOWN), 0 );
|
||||
if( leftPressed )
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_LEFT), 0 );
|
||||
if( rightPressed )
|
||||
SDL_ANDROID_MainThreadPushKeyboardKey( SDL_RELEASED, TranslateKey(KEYCODE_DPAD_RIGHT), 0 );
|
||||
upPressed = 0;
|
||||
downPressed = 0;
|
||||
leftPressed = 0;
|
||||
rightPressed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int SDL_SYS_JoystickInit(void)
|
||||
{
|
||||
SDL_numjoysticks = JOY_GAMEPAD4 + 1;
|
||||
|
||||
@@ -73,7 +73,6 @@ extern int SDL_ANDROID_IsScreenKeyboardShownFlag;
|
||||
extern int SDL_ANDROID_drawTouchscreenKeyboard();
|
||||
extern void SDL_ANDROID_VideoContextLost();
|
||||
extern void SDL_ANDROID_VideoContextRecreated();
|
||||
extern void SDL_ANDROID_processAndroidTrackballDampening();
|
||||
extern void SDL_ANDROID_processMoveMouseWithKeyboard();
|
||||
extern int SDL_ANDROID_InsideVideoThread();
|
||||
extern void SDL_ANDROID_initFakeStdout();
|
||||
|
||||
Reference in New Issue
Block a user