Description
Draws a button widjet
Syntax
button(s, x, y, w, h, id)
Parameters
s : button label
x : x-coordinate
y : y-coordinate
w : width
h : height
id : id of button (range : 1 ~ 99)
Usages
button("OK", 200, 200, 120, 80, 1)
Examples in arduino
#include "AppGosu.h"
AppGosu app;
void setup() {
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
app.textSize(30);
if( app.eventButton(1)) {
app.background(0,0,0);
app.text("button clicked ", 200, 150);
}
}
//---------------------------------------------------------
void myStart(void) {
// user starting code here
app.clearAll();
app.background(0,0,0);
app.textSize(50);
app.fill(255,255,255);
app.text("--- button ---", 60, 50);
// button
app.button(" Click ", 10, 100, 150, 80, 1);
}
Examples in other MCU (AVR, PIC, MSP430)
printf("button('button label',10,100,150,80,1);");
from AppGosu
-----------------------------------------
No comments:
Post a Comment