diff options
| author | raysan5 <raysan5@gmail.com> | 2015-07-13 18:16:24 +0200 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2015-07-13 18:16:24 +0200 |
| commit | d686cc6c4affd60d7035161ff8a386687b2c5993 (patch) | |
| tree | 34c2240216226066214fc4546cb078f48f22d4f6 /src | |
| parent | d50194940da6e9d048fe82ab2fbdedf8a269f99f (diff) | |
| download | raylib-d686cc6c4affd60d7035161ff8a386687b2c5993.tar.gz raylib-d686cc6c4affd60d7035161ff8a386687b2c5993.zip | |
Some small code tweaks
Diffstat (limited to 'src')
| -rw-r--r-- | src/gestures.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gestures.c b/src/gestures.c index 5b62cbff..ad8ac9f6 100644 --- a/src/gestures.c +++ b/src/gestures.c @@ -132,10 +132,10 @@ static Vector2 touchPosition; //---------------------------------------------------------------------------------- // Module specific Functions Declaration //---------------------------------------------------------------------------------- -extern void ProcessMotionEvent(GestureEvent event); extern void ResetGestures(void); extern Vector2 GetRawPosition(void); +static void ProcessMotionEvent(GestureEvent event); static float CalculateAngle(Vector2 initialPosition, Vector2 actualPosition, float magnitude); static float OnPinch(); static void SetDualInput(GestureEvent event); @@ -265,7 +265,7 @@ extern void InitAndroidGestures(struct android_app *app) //---------------------------------------------------------------------------------- // Module specific Functions Definition //---------------------------------------------------------------------------------- -extern void ProcessMotionEvent(GestureEvent event) +static void ProcessMotionEvent(GestureEvent event) { // Resets dragVector = (Vector2){ 0, 0 }; @@ -359,7 +359,7 @@ extern void ProcessMotionEvent(GestureEvent event) { lastDragPosition = endDragPosition; - endDragPosition = GetRawPosition(); + endDragPosition = touchPosition; //endDragPosition.x = AMotionEvent_getX(event, 0); //endDragPosition.y = AMotionEvent_getY(event, 0); @@ -568,6 +568,18 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event) { //int32_t key = AKeyEvent_getKeyCode(event); //int32_t AKeyEvent_getMetaState(event); + + int32_t code = AKeyEvent_getKeyCode((const AInputEvent *)event); + + // If we are in active mode, we eat the back button and move into pause mode. + // If we are already in pause mode, we allow the back button to be handled by the OS, which means we'll be shut down. + /* + if ((code == AKEYCODE_BACK) && mActiveMode) + { + setActiveMode(false); + return 1; + } + */ } int32_t action = AMotionEvent_getAction(event); @@ -589,7 +601,7 @@ static int32_t AndroidInputCallback(struct android_app *app, AInputEvent *event) ProcessMotionEvent(gestureEvent); - return 0; + return 0; // return 1; } #endif |
