Hello everyone,
I'm pretty new to processing and I have started trying to learn to program simple games por android. I'm trying to use the ketai library to recognise gestures (flick, pinch and rotate). The code compiles and executes correctly but nothing seems to work on my phone. I am following this simple tutorial and using the exact same code he uses in this video:
Here's the code I'm using, extracted from the video. I also tried a fix proposed by a user in the comment section, with no luck:
import ketai.ui.*;
import android.view.MotionEvent;
KetaiGesture gesture;
int rectSize = 100;
float rectAngle;
float rectColor;
void setup(){
rectMode(CENTER);
gesture = new KetaiGesture(this);
}
void draw(){
translate (width/2,height/2);
rotate(rectAngle);
fill(rectColor);
rect(0,0,rectSize,rectSize);
}
void onPinch (float x, float y, float d){
rectSize += d;
}
void onRotate (float x, float y, float angle){
rectAngle += angle;
}
void onFlick (float x, float y, float px, float py, float v){
rectColor = color(random(255), random(255), random(255));
}
public boolean surfaceTouchEvent(MotionEvent event) {
//call to keep mouseX, mouseY, etc updated
super.surfaceTouchEvent(event);
//forward event to class for processing
return gesture.surfaceTouchEvent(event);
}
Does anyone know how to fix this, or any other gesture library that's easy to implement?
Thanks in advance!