From a7b83cb68872db3bbcde751ab72288525de90d75 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Thu, 11 May 2023 20:22:27 -0400 Subject: [PATCH] Removed Joystick trackball support. --- project/include/ui/Joystick.h | 1 - project/include/ui/JoystickEvent.h | 2 +- project/src/ExternalInterface.cpp | 16 ---------------- project/src/backend/sdl/SDLApplication.cpp | 14 -------------- project/src/backend/sdl/SDLJoystick.cpp | 7 ------- .../backend/native/NativeApplication.hx | 6 +----- src/lime/_internal/backend/native/NativeCFFI.hx | 10 ---------- src/lime/app/Application.hx | 10 ---------- src/lime/ui/Joystick.hx | 11 ----------- .../main/java/org/libsdl/app/SDLActivity.java | 8 +------- 10 files changed, 3 insertions(+), 82 deletions(-) diff --git a/project/include/ui/Joystick.h b/project/include/ui/Joystick.h index 560865c75..08e403476 100644 --- a/project/include/ui/Joystick.h +++ b/project/include/ui/Joystick.h @@ -14,7 +14,6 @@ namespace lime { static int GetNumAxes (int id); static int GetNumButtons (int id); static int GetNumHats (int id); - static int GetNumTrackballs (int id); }; diff --git a/project/include/ui/JoystickEvent.h b/project/include/ui/JoystickEvent.h index 34138fa83..44276e6d9 100644 --- a/project/include/ui/JoystickEvent.h +++ b/project/include/ui/JoystickEvent.h @@ -13,7 +13,7 @@ namespace lime { JOYSTICK_AXIS_MOVE, JOYSTICK_HAT_MOVE, - JOYSTICK_TRACKBALL_MOVE, + // JOYSTICK_TRACKBALL_MOVE, JOYSTICK_BUTTON_DOWN, JOYSTICK_BUTTON_UP, JOYSTICK_CONNECT, diff --git a/project/src/ExternalInterface.cpp b/project/src/ExternalInterface.cpp index b3453d621..be1e6b44e 100644 --- a/project/src/ExternalInterface.cpp +++ b/project/src/ExternalInterface.cpp @@ -2307,20 +2307,6 @@ namespace lime { } - int lime_joystick_get_num_trackballs (int id) { - - return Joystick::GetNumTrackballs (id); - - } - - - HL_PRIM int HL_NAME(hl_joystick_get_num_trackballs) (int id) { - - return Joystick::GetNumTrackballs (id); - - } - - value lime_jpeg_decode_bytes (value data, bool decodeData, value buffer) { ImageBuffer imageBuffer (buffer); @@ -3995,7 +3981,6 @@ namespace lime { DEFINE_PRIME1 (lime_joystick_get_num_axes); DEFINE_PRIME1 (lime_joystick_get_num_buttons); DEFINE_PRIME1 (lime_joystick_get_num_hats); - DEFINE_PRIME1 (lime_joystick_get_num_trackballs); DEFINE_PRIME3 (lime_jpeg_decode_bytes); DEFINE_PRIME3 (lime_jpeg_decode_file); DEFINE_PRIME1 (lime_key_code_from_scan_code); @@ -4184,7 +4169,6 @@ namespace lime { DEFINE_HL_PRIM (_I32, hl_joystick_get_num_axes, _I32); DEFINE_HL_PRIM (_I32, hl_joystick_get_num_buttons, _I32); DEFINE_HL_PRIM (_I32, hl_joystick_get_num_hats, _I32); - DEFINE_HL_PRIM (_I32, hl_joystick_get_num_trackballs, _I32); DEFINE_HL_PRIM (_TIMAGEBUFFER, hl_jpeg_decode_bytes, _TBYTES _BOOL _TIMAGEBUFFER); DEFINE_HL_PRIM (_TIMAGEBUFFER, hl_jpeg_decode_file, _STRING _BOOL _TIMAGEBUFFER); DEFINE_HL_PRIM (_F32, hl_key_code_from_scan_code, _F32); diff --git a/project/src/backend/sdl/SDLApplication.cpp b/project/src/backend/sdl/SDLApplication.cpp index 7948d769d..cd91af2e5 100644 --- a/project/src/backend/sdl/SDLApplication.cpp +++ b/project/src/backend/sdl/SDLApplication.cpp @@ -474,20 +474,6 @@ namespace lime { } break; - case SDL_JOYBALLMOTION: - - if (!SDLJoystick::IsAccelerometer (event->jball.which)) { - - joystickEvent.type = JOYSTICK_TRACKBALL_MOVE; - joystickEvent.index = event->jball.ball; - joystickEvent.x = event->jball.xrel / (event->jball.xrel > 0 ? 32767.0 : 32768.0); - joystickEvent.y = event->jball.yrel / (event->jball.yrel > 0 ? 32767.0 : 32768.0); - joystickEvent.id = event->jball.which; - - JoystickEvent::Dispatch (&joystickEvent); - - } - break; case SDL_JOYBUTTONDOWN: diff --git a/project/src/backend/sdl/SDLJoystick.cpp b/project/src/backend/sdl/SDLJoystick.cpp index 2ed1a96d7..de0a4283f 100644 --- a/project/src/backend/sdl/SDLJoystick.cpp +++ b/project/src/backend/sdl/SDLJoystick.cpp @@ -117,11 +117,4 @@ namespace lime { } - int Joystick::GetNumTrackballs (int id) { - - return SDL_JoystickNumBalls (joysticks[id]); - - } - - } diff --git a/src/lime/_internal/backend/native/NativeApplication.hx b/src/lime/_internal/backend/native/NativeApplication.hx index 9f166c54f..911246bc8 100644 --- a/src/lime/_internal/backend/native/NativeApplication.hx +++ b/src/lime/_internal/backend/native/NativeApplication.hx @@ -227,10 +227,6 @@ class NativeApplication var joystick = Joystick.devices.get(joystickEventInfo.id); if (joystick != null) joystick.onHatMove.dispatch(joystickEventInfo.index, joystickEventInfo.eventValue); - case TRACKBALL_MOVE: - var joystick = Joystick.devices.get(joystickEventInfo.id); - if (joystick != null) joystick.onTrackballMove.dispatch(joystickEventInfo.index, joystickEventInfo.x, joystickEventInfo.y); - case BUTTON_DOWN: var joystick = Joystick.devices.get(joystickEventInfo.id); if (joystick != null) joystick.onButtonDown.dispatch(joystickEventInfo.index); @@ -746,7 +742,7 @@ class NativeApplication { var AXIS_MOVE = 0; var HAT_MOVE = 1; - var TRACKBALL_MOVE = 2; + // var TRACKBALL_MOVE = 2; var BUTTON_DOWN = 3; var BUTTON_UP = 4; var CONNECT = 5; diff --git a/src/lime/_internal/backend/native/NativeCFFI.hx b/src/lime/_internal/backend/native/NativeCFFI.hx index 6b6d5f8d7..7d3b6e65e 100644 --- a/src/lime/_internal/backend/native/NativeCFFI.hx +++ b/src/lime/_internal/backend/native/NativeCFFI.hx @@ -213,8 +213,6 @@ class NativeCFFI @:cffi private static function lime_joystick_get_num_hats(id:Int):Int; - @:cffi private static function lime_joystick_get_num_trackballs(id:Int):Int; - @:cffi private static function lime_joystick_event_manager_register(callback:Dynamic, eventObject:Dynamic):Void; @:cffi private static function lime_jpeg_decode_bytes(data:Dynamic, decodeData:Bool, buffer:Dynamic):Dynamic; @@ -495,8 +493,6 @@ class NativeCFFI private static var lime_joystick_get_num_axes = new cpp.CallableInt>(cpp.Prime._loadPrime("lime", "lime_joystick_get_num_axes", "ii", false)); private static var lime_joystick_get_num_buttons = new cpp.CallableInt>(cpp.Prime._loadPrime("lime", "lime_joystick_get_num_buttons", "ii", false)); private static var lime_joystick_get_num_hats = new cpp.CallableInt>(cpp.Prime._loadPrime("lime", "lime_joystick_get_num_hats", "ii", false)); - private static var lime_joystick_get_num_trackballs = new cpp.CallableInt>(cpp.Prime._loadPrime("lime", "lime_joystick_get_num_trackballs", "ii", - false)); private static var lime_joystick_event_manager_register = new cpp.Callablecpp.Object->cpp.Void>(cpp.Prime._loadPrime("lime", "lime_joystick_event_manager_register", "oov", false)); private static var lime_jpeg_decode_bytes = new cpp.CallableBool->cpp.Object->cpp.Object>(cpp.Prime._loadPrime("lime", @@ -706,7 +702,6 @@ class NativeCFFI private static var lime_joystick_get_num_axes = CFFI.load("lime", "lime_joystick_get_num_axes", 1); private static var lime_joystick_get_num_buttons = CFFI.load("lime", "lime_joystick_get_num_buttons", 1); private static var lime_joystick_get_num_hats = CFFI.load("lime", "lime_joystick_get_num_hats", 1); - private static var lime_joystick_get_num_trackballs = CFFI.load("lime", "lime_joystick_get_num_trackballs", 1); private static var lime_joystick_event_manager_register = CFFI.load("lime", "lime_joystick_event_manager_register", 2); private static var lime_jpeg_decode_bytes = CFFI.load("lime", "lime_jpeg_decode_bytes", 3); private static var lime_jpeg_decode_file = CFFI.load("lime", "lime_jpeg_decode_file", 3); @@ -1113,11 +1108,6 @@ class NativeCFFI return 0; } - @:hlNative("lime", "hl_joystick_get_num_trackballs") private static function lime_joystick_get_num_trackballs(id:Int):Int - { - return 0; - } - @:hlNative("lime", "hl_joystick_event_manager_register") private static function lime_joystick_event_manager_register(callback:Void->Void, eventObject:JoystickEventInfo):Void {} diff --git a/src/lime/app/Application.hx b/src/lime/app/Application.hx index 3348e3f4e..87cf6ce6d 100644 --- a/src/lime/app/Application.hx +++ b/src/lime/app/Application.hx @@ -226,15 +226,6 @@ class Application extends Module **/ public function onJoystickHatMove(joystick:Joystick, hat:Int, position:JoystickHatPosition):Void {} - /** - Called when a joystick axis move event is fired - @param joystick The current joystick - @param trackball The trackball that was moved - @param x The x movement of the trackball (between 0 and 1) - @param y The y movement of the trackball (between 0 and 1) - **/ - public function onJoystickTrackballMove(joystick:Joystick, trackball:Int, x:Float, y:Float):Void {} - /** Called when a key down event is fired on the primary window @param keyCode The code of the key that was pressed @@ -585,7 +576,6 @@ class Application extends Module joystick.onButtonUp.add(onJoystickButtonUp.bind(joystick)); joystick.onDisconnect.add(onJoystickDisconnect.bind(joystick)); joystick.onHatMove.add(onJoystickHatMove.bind(joystick)); - joystick.onTrackballMove.add(onJoystickTrackballMove.bind(joystick)); } @:noCompletion private function __onModuleExit(code:Int):Void diff --git a/src/lime/ui/Joystick.hx b/src/lime/ui/Joystick.hx index 55bf70cf9..2215c8d17 100644 --- a/src/lime/ui/Joystick.hx +++ b/src/lime/ui/Joystick.hx @@ -20,13 +20,11 @@ class Joystick public var numAxes(get, never):Int; public var numButtons(get, never):Int; public var numHats(get, never):Int; - public var numTrackballs(get, never):Int; public var onAxisMove = new EventFloat->Void>(); public var onButtonDown = new EventVoid>(); public var onButtonUp = new EventVoid>(); public var onDisconnect = new EventVoid>(); public var onHatMove = new EventJoystickHatPosition->Void>(); - public var onTrackballMove = new EventFloat->Float->Void>(); public function new(id:Int) { @@ -125,13 +123,4 @@ class Joystick return 0; #end } - - @:noCompletion private inline function get_numTrackballs():Int - { - #if (lime_cffi && !macro) - return NativeCFFI.lime_joystick_get_num_trackballs(this.id); - #else - return 0; - #end - } } diff --git a/templates/android/template/app/src/main/java/org/libsdl/app/SDLActivity.java b/templates/android/template/app/src/main/java/org/libsdl/app/SDLActivity.java index f2192e472..a34371404 100644 --- a/templates/android/template/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/templates/android/template/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -80,15 +80,13 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh if ((s & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) cls += " JOYSTICK"; if ((s & InputDevice.SOURCE_CLASS_POINTER) != 0) cls += " POINTER"; if ((s & InputDevice.SOURCE_CLASS_POSITION) != 0) cls += " POSITION"; - if ((s & InputDevice.SOURCE_CLASS_TRACKBALL) != 0) cls += " TRACKBALL"; int s2 = s_copy & ~InputDevice.SOURCE_ANY; // keep class bits s2 &= ~( InputDevice.SOURCE_CLASS_BUTTON | InputDevice.SOURCE_CLASS_JOYSTICK | InputDevice.SOURCE_CLASS_POINTER - | InputDevice.SOURCE_CLASS_POSITION - | InputDevice.SOURCE_CLASS_TRACKBALL); + | InputDevice.SOURCE_CLASS_POSITION); if (s2 != 0) cls += "Some_Unkown"; @@ -147,10 +145,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh if ((s & tst) == tst) src += " TOUCH_NAVIGATION"; s2 &= ~tst; - tst = InputDevice.SOURCE_TRACKBALL; - if ((s & tst) == tst) src += " TRACKBALL"; - s2 &= ~tst; - tst = InputDevice.SOURCE_ANY; if ((s & tst) == tst) src += " ANY"; s2 &= ~tst;