Just made a simple controller for processing for Android. I need help with the output in which I would like a angle instead of a x & y position as the out put
class Controller
{
int touches_on;
float d;
PVector right_mouse = new PVector(0,0);
PVector left_mouse = new PVector(0,0);
PVector right_mouse_output = new PVector(0,0);
PVector left_mouse_output = new PVector(0,0);
Controller(float D)
{
d = D;
}
void All ()
{
noFill();
strokeWeight(10);
stroke(100);
//start
if(touches.length == 0)
{
touches_on = 3;
}
//start for
for(int i = 0; i < touches.length; i++)
{
if( touches[i].y > height/2 && touches_on == 3 )
{
touches_on = i;
}
if(i == touches_on && touches[i].y > height/2)
{
right_mouse.x = touches[i].x;
right_mouse.y = touches[i].y;
if(right_mouse.x > d*0.75 + d/2){right_mouse.x = d*0.75+d/2;}
else if(right_mouse.x < d*0.75 - d/2){right_mouse.x = d*0.75-d/2;}
if(right_mouse.y > height-d*0.75 + d/2){right_mouse.y = height-d*0.75+d/2;}
else if(right_mouse.y < height-d*0.75 - d/2){right_mouse.y = height-d*0.75-d/2;}
ellipse(right_mouse.x, right_mouse.y , d/2 , d/2);
right_mouse_output.x = right_mouse.x - d*0.75;
right_mouse_output.y = height-d*0.75-right_mouse.y;
}
else if(i != touches_on && touches[i].y < height/2)
{
left_mouse.x = touches[i].x;
left_mouse.y = touches[i].y;
if(left_mouse.x > d*0.75 + d/2){left_mouse.x = d*0.75+d/2;}
else if(left_mouse.x < d*0.75 - d/2){left_mouse.x = d*0.75-d/2;}
if(left_mouse.y > d*0.75 + d/2){left_mouse.y = d*0.75+d/2;}
else if(left_mouse.y < d*0.75 - d/2){left_mouse.y = d*0.75-d/2;}
ellipse(left_mouse.x , left_mouse.y , d/2, d/2);
left_mouse_output.x = left_mouse.x - d*0.75;
left_mouse_output.y = left_mouse.y - d*0.75;
}
//for end
}
ellipse(d * 0.75,d * 0.75, d, d);
ellipse(d * 0.75, height-d * 0.75, d, d);
//stop
//end
}
}