Convert a toggle for multitouch purpose

Hi there, past days with the special help of this forum i archive some tools such toggle and button, i need it for multitouch purpose on android, i understand that mouse parameter are not correct for multitouch, i already read what there is on processing android site but i phish to obtain a little help to convert this class for android multi touch purpose. Thanks a lot

class Toggle {
  boolean state;
  boolean ready;
  boolean blink;
  int x, y, w, h, delta; // x,y,w,h
  Toggle(int ix, int iy, int iw, int ih) {
    blink = false;
    state = false;
    ready = true;
    x = ix;
    y = iy;
    w = iw;
    h = ih;
  void draw() {
    if(blink == true){delta = 32;} else {delta = 0;}

    if ( mousePressed ) {
      if (ready && mouseX >= x && mouseX <= (x+w) && mouseY >= y && mouseY <= (y+h) ) {
        ready = false;
        state = !state;
    } else {
      ready = true;
    if (state) {
    rect(x, y, w, h);


  • @chanof===

    sorry, i dont understand what you want: rewriting this for android touchEvent is very simple but what is the "multitouch"???

  • Hi akenaton! Yes, i need the possibility to control more then one in the same time, actually i use mouse structure, and in android there is always only one possibility per time. How can i obtain the possibility to have multitouch?

  • @chanof=== use the motionEvent android class

  • Thanks! Time ago you talk me about libpd to send midi from processing / android thru onboard usb android device. Making musical apps e book say

    "As we saw in Chapter 2, there are really only two realistic use cases for MIDI in a mobile musical app. You may want to control external MIDI hardware with your app, or you may want to have your app control a patch that was designed to take its input from a MIDI device.

    In the first case, you will be responsible for writing the boilerplate that connects libpd to the MIDI API of your platform (if any). It’s not hard, but since this is a rare requirement for mobile apps, we won’t discuss it any further."

    Su i would ask what is "boilerplate" ? what i need more then libpd? May i ask you a little bit of light about ?

  • Answer ✓


    sorry, i only used libpd for the second case: playing pd patches with android; and i think of course that the "first case" is much more complex depending of the external hardware you are using: boilerplate as he says!

Sign In or Register to comment.