// clayout // thomas.waelti@edk.unibe.ch check(int x,int y) { if (x<40 && y>150) return -1; if (x<80 && x>40 && y>150) return -2; if (x<120 && x>80 && y>150) return -3; if (x>140 && y>150) return -4; return 0; } refresh(int f,int c,int u) { rect(1,0,150,160,160,0); line(2,40,150,40,160); line(2,80,150,80,160); line(2,120,150,120,160); textattr(1,2,0); text(3,150," font "+f); text(49,150,"col "+c); text(83,150,"u_line"+u); text(130,150,"CLR "); } main() { int x,y,f,c,u; string lo; x=y=30; f=u=0; c=1; graph_on(); title("clayoutª"); lo=gets("Please enter the word(s) to c-layout:"); refresh(f,c,u); while(1){ while (wait()==-1){ x=penx(); y=peny(); if (check (x,y)==-1) { f=f+1; if (f==7) f=0; } if (check(x,y)==-2) { c=c+1; if (c==3) c=1; } if (check(x,y)==-3) { u=u+1; if (u==3) u=0; } if (check(x,y)==-4) clearg(); refresh(f,c,u); if (check(x,y)==0) { textattr(f,c,u); text(x,y,lo);} } graph_off(); puts("textattr("+f+","+c+","+u+");\n"); puts("text("+x+","+y+",\""+lo+"\");\n"); break; } }