How to achieve redraw without mousePress?

edited May 2015 in Questions about Code

Here is my code, i need to achieve redraw by mousePress. But i want to write the code that when y=300, it code will redraw automatically. By the way, i println my code in gcode writing way, when the code start, it will show in the black window. It is helpful to check each value of x and y

`int x,y,e; void setup(){ x=5; y=0; size(500,500); }

void draw(){ background(255,255,255); y=y+1;

if (y>300){ y=300; point(x,y); }

String[] gcode=new String[6];

gcode[0]="X"; gcode[1]=str(x); gcode[2]="Y"; gcode[3]=str(y); gcode[4]="E"; gcode[5]=str(e);

String joinedgcode = join(gcode,""); println(joinedgcode);

e+=1; }

void mousePressed() { x += 1; y=0; redraw(); }`

Answers

Sign In or Register to comment.