# How to make a Android controller

**URL:** <https://discourse.processing.org/t/how-to-make-a-android-controller/13637>\
**Category:** Processing for Android\
**Created:** [August 27, 2019, 12:02am UTC](https://discourse.processing.org/t/how-to-make-a-android-controller/13637 "2019-08-27T00:02:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chinnah](https://avatars.discourse-cdn.com/v4/letter/c/a87d85/32.png) [@Chinnah](https://discourse.processing.org/u/Chinnah)\
**Post date:** [August 27, 2019, 12:02am UTC](https://discourse.processing.org/t/how-to-make-a-android-controller/13637/1 "2019-08-27T00:02:42Z")

</div>

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  
}

}
