Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release 1.3 android template small bug #68

Closed
dmalves opened this issue Dec 30, 2015 · 3 comments
Closed

release 1.3 android template small bug #68

dmalves opened this issue Dec 30, 2015 · 3 comments

Comments

@dmalves
Copy link

dmalves commented Dec 30, 2015

IsScreenTouched() from 1.2 is used where I guess IsGestureDetected() from 1.3 should be used.

affected file:

https://github.com/raysan5/raylib/blob/master/templates/android_project/jni/basic_game.c

after that compilation to android compiles just fine and the app runs. I had to add
InitGesturesSystem(struct android_app *app);
and
void UpdateGestures(void);

to make it work, but still the game screen jumps from TITLE to GAME to END to TITLE again very fast while I hold my finger on the tablet screen.

I just modified a few lines:
https://gist.github.com/dmalves/de34b9a56be2c9d5ebb0

How can I detect a single screen tough?

@dmalves
Copy link
Author

dmalves commented Dec 30, 2015

Now, I keep correcting myself. I added GetGestureType and made it work properly. I see that
SetGesturesEnabled is not been used (implemented) It would be nice to choose what gestures to lesson to.
And about this:

bool IsGestureDetected(void)
{
/*
if (currentGesture == GESTURE_DRAG) TraceLog(INFO, "DRAG");
else if (currentGesture == GESTURE_TAP) TraceLog(INFO, "TAP");
else if (currentGesture == GESTURE_DOUBLETAP) TraceLog(INFO, "DOUBLE");
else if (currentGesture == GESTURE_HOLD) TraceLog(INFO, "HOLD");
else if (currentGesture == GESTURE_SWIPE_RIGHT) TraceLog(INFO, "RIGHT");
else if (currentGesture == GESTURE_SWIPE_UP) TraceLog(INFO, "UP");
else if (currentGesture == GESTURE_SWIPE_LEFT) TraceLog(INFO, "LEFT");
else if (currentGesture == GESTURE_SWIPE_DOWN) TraceLog(INFO, "DOWN");
else if (currentGesture == GESTURE_PINCH_IN) TraceLog(INFO, "PINCH IN");
else if (currentGesture == GESTURE_PINCH_OUT) TraceLog(INFO, "PINCH OUT");
*/

if (currentGesture != GESTURE_NONE) return true;
else return false;

}

Maybe it is a good idea to keep the trace logs on user events, but only on the debug version.

working sample:
https://gist.github.com/dmalves/b0961dbe161d4776bcac

@victorfisac
Copy link
Contributor

Hi, I'm currently working on that at #67

IsScreenTouched() from 1.2 already checked TAP input so detecting the scene switch worked fine one per touch. But now in 1.3 IsGestureDetected() returns true when any type of input is detected (look at gestures.h Gestures enum type data, line 56).

You can improve the code just checking GetGestureType() return value. If you see IsGestureDetected() declaration, it just checks if GetGestureType() is not GESTURE_NONE, so you are doing the same thing twice.

@raysan5
Copy link
Owner

raysan5 commented Dec 30, 2015

Hi @dmalves! Gestures module has been reviewed in develop branch for raylib 1.4.

Thanks @victorfisac for taking care of this issue. I just merged your pull request #67 and commented it.

@raysan5 raysan5 closed this as completed Dec 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants