eventMousePressRect

eventMousePressRect( )

Description
Event handler of mousePressRect  widjet

Syntax
Boolean  eventMousePressRect(id) 


Parameters
  id : id of mousePressRect
  return value : 1 (if mousePressRect clicked)


Usages
eventMousePressRect(1)


Examples in arduino

#include "AppGosu.h"
AppGosu app;

int LED = 13;

void setup() {    

    pinMode(LED,OUTPUT);
    digitalWrite(LED, HIGH); // LED on
    app.start();
    app.setDelayCmd(20);  // max speed 20ms

    myStart();
}

void loop() {
  
 
} // end of loop

//---------------------------------------------------------
void serialEvent() {
      app.serialMessage();
      EventLoop();
}
void EventLoop() {
    if( app.btConnected()) {   // for auto starting
        myStart();
    }
  
    // user event code here
      
        if( app.eventMousePressRect(1)) {    // event handler
            app.image("appledOn.png", 120, 220, 250, 380);
            digitalWrite(LED, HIGH); // LED on
        }
        if( app.eventMousePressRect(2)) {
            app.image("appledOff.png", 120, 220, 250, 380);
            digitalWrite(LED, LOW); // LED off                
        }

}
//---------------------------------------------------------
void myStart(void) {
    // user starting code here
 
    app.clearAll();
    app.background(0,0,0);
    app.textSize(50);
    app.fill(255,255,255);
    app.text("-- mousePressRect --", 20, 50);
  
    // mousePressRect
    app.mousePressRect(120, 220, 250, 200, 1);
    app.mousePressRect(120, 420, 250, 200, 2);
  
    app.image("appledOff.png", 120, 220, 250, 380);

}














by AppGosu
-----------------------------------------










No comments: