Option to assign mouse click to any HW key
This commit is contained in:
@@ -22,8 +22,8 @@ AppTouchscreenKeyboardKeysAmount=0
|
||||
AppTouchscreenKeyboardKeysAmountAutoFire=0
|
||||
RedefinedKeysScreenKb="LALT RETURN KP_PLUS KP_MINUS SPACE DELETE KP_PLUS KP_MINUS 1 2"
|
||||
MultiABI=n
|
||||
AppVersionCode=10510
|
||||
AppVersionName="1.0.5.10"
|
||||
AppVersionCode=10511
|
||||
AppVersionName="1.0.5.11"
|
||||
CompiledLibraries="jpeg png freetype timidity lzma lzo2"
|
||||
CustomBuildScript=y
|
||||
AppCflags=''
|
||||
|
||||
@@ -1 +1 @@
|
||||
fheroes2
|
||||
openttd
|
||||
@@ -57,10 +57,12 @@ static inline SDL_scancode TranslateKey(int scancode)
|
||||
static int isTrackballUsed = 0;
|
||||
static int isMouseUsed = 0;
|
||||
|
||||
enum { RIGHT_CLICK_NONE = 0, RIGHT_CLICK_WITH_MULTITOUCH = 1, RIGHT_CLICK_WITH_PRESSURE = 2, RIGHT_CLICK_WITH_MENU_BUTTON = 3 };
|
||||
enum { LEFT_CLICK_NORMAL = 0, LEFT_CLICK_NEAR_CURSOR = 1, LEFT_CLICK_WITH_MULTITOUCH = 2, LEFT_CLICK_WITH_PRESSURE = 3, LEFT_CLICK_WITH_DPAD = 4 };
|
||||
enum { RIGHT_CLICK_NONE = 0, RIGHT_CLICK_WITH_MULTITOUCH = 1, RIGHT_CLICK_WITH_PRESSURE = 2, RIGHT_CLICK_WITH_KEY = 3 };
|
||||
enum { LEFT_CLICK_NORMAL = 0, LEFT_CLICK_NEAR_CURSOR = 1, LEFT_CLICK_WITH_MULTITOUCH = 2, LEFT_CLICK_WITH_PRESSURE = 3, LEFT_CLICK_WITH_KEY = 4 };
|
||||
static int leftClickMethod = LEFT_CLICK_NORMAL;
|
||||
static int rightClickMethod = RIGHT_CLICK_NONE;
|
||||
static int leftClickKey = KEYCODE_DPAD_CENTER;
|
||||
static int rightClickKey = KEYCODE_MENU;
|
||||
int SDL_ANDROID_ShowScreenUnderFinger = 0;
|
||||
SDL_Rect SDL_ANDROID_ShowScreenUnderFingerRect = {0, 0, 0, 0}, SDL_ANDROID_ShowScreenUnderFingerRectSrc = {0, 0, 0, 0};
|
||||
static int moveMouseWithArrowKeys = 0;
|
||||
@@ -480,12 +482,12 @@ JAVA_EXPORT_NAME(DemoGLSurfaceView_nativeKey) ( JNIEnv* env, jobject thiz, jint
|
||||
if( isTrackballUsed )
|
||||
if( processAndroidTrackball(key, action) )
|
||||
return;
|
||||
if( key == KEYCODE_MENU && rightClickMethod == RIGHT_CLICK_WITH_MENU_BUTTON )
|
||||
if( key == rightClickKey && rightClickMethod == RIGHT_CLICK_WITH_KEY )
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushMouseButton( action ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT );
|
||||
return;
|
||||
}
|
||||
if( key == KEYCODE_DPAD_CENTER && ( clickMouseWithDpadCenter || leftClickMethod == LEFT_CLICK_WITH_DPAD ) )
|
||||
if( (key == leftClickKey && leftClickMethod == LEFT_CLICK_WITH_KEY) || (clickMouseWithDpadCenter && key == KEYCODE_DPAD_CENTER) )
|
||||
{
|
||||
SDL_ANDROID_MainThreadPushMouseButton( action ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT );
|
||||
return;
|
||||
@@ -546,7 +548,8 @@ JAVA_EXPORT_NAME(Settings_nativeSetMouseUsed) ( JNIEnv* env, jobject thiz,
|
||||
jint RightClickMethod, jint ShowScreenUnderFinger, jint LeftClickMethod,
|
||||
jint MoveMouseWithJoystick, jint ClickMouseWithDpad,
|
||||
jint MaxForce, jint MaxRadius,
|
||||
jint MoveMouseWithJoystickSpeed, jint MoveMouseWithJoystickAccel)
|
||||
jint MoveMouseWithJoystickSpeed, jint MoveMouseWithJoystickAccel,
|
||||
jint LeftClickKeycode, jint RightClickKeycode)
|
||||
{
|
||||
isMouseUsed = 1;
|
||||
rightClickMethod = RightClickMethod;
|
||||
@@ -558,6 +561,8 @@ JAVA_EXPORT_NAME(Settings_nativeSetMouseUsed) ( JNIEnv* env, jobject thiz,
|
||||
maxRadius = MaxRadius;
|
||||
moveMouseWithKbSpeed = MoveMouseWithJoystickSpeed + 1;
|
||||
moveMouseWithKbAccel = MoveMouseWithJoystickAccel;
|
||||
leftClickKey = LeftClickKeycode;
|
||||
rightClickKey = RightClickKeycode;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
|
||||
Reference in New Issue
Block a user