! GR.OPEN         0,0,0,40,0,1 ! main parameters -------------- ARRAY.LOAD      nCtrl[], 60, 120, 180 , 240 ARRAY.LOAD      nCols[], 6,  8,   10  , 12 ARRAY.LOAD      rad[],   44, 32,  27  , 21 variant       = 1 nctrl         = nCtrl [variant] nCols         = nCols [variant] rad           = rad   [variant] GOSUB          init  !main loop ----------------- DO PAUSE 33 UNTIL0 !------------------------ END !callbackRoutines (but individual) ------------ _1::  PRINT "button: ";1  : RETURN  _2::  PRINT "button: ";2  : RETURN  _3::  PRINT "button: ";3  : RETURN  _4::  PRINT "button: ";4  : RETURN  _5::  PRINT "button: ";5  : RETURN  _6::  PRINT "button: ";6  : RETURN  _7::  PRINT "button: ";7  : RETURN  _8::  PRINT "button: ";8  : RETURN  _9::  PRINT "button: ";9  : RETURN  _10:: PRINT "button: ";10 : RETURN  !   ....and so on  !------------------------------------ !press action (all buts) -------- butPressAction: RETURN !------------------------ !release action (all buts) ------ butReleaseAction: txt$         += CHR$(47+ curBut ) IF              !MOD(LEN(txt$),20) THEN  txt$ =""+CHR$(47+curBut) GR.MODIFY       txt1, "text", txt$ VIBRATE         vib2[],-1 RETURN !------------------------ !=========================================== !Private part ============================== !------------------------ ONGRTOUCH: GOSUB           butPressAction curBut        = 0 DO GR.TOUCH       tou,tx,ty GR.MODIFY      dum ,"x", tx, "y", ty FOR i        = 1 TO nctrl   IF            GR_COLLISION(ctrl[i],dum) THEN GOSUB colliHandle NEXT UNTIL           !tou IF               curBut GR.MODIFY       ctrl[curBut]+2, "alpha", 255 GOSUB           curBut, _1,_2,_3,_4,_5,_6,_7,_8,_9,_10 GOSUB           butReleaseAction GR.RENDER ENDIF GR.ONGRTOUCH.RESUME !------------------------ !------------------------ colliHandle: IF               i <> curBut THEN VIBRATE         vib1[],-1 IF              curBut THEN GR.MODIFY ctrl[curBut]+2, "alpha", 255 GR.MODIFY       ctrl[i]+2       , "alpha", 0 curBut    = i GR.RENDER ENDIF RETURN !------------------------ !------------------------------- init:  GOSUB           userfun GR.COLOR        0 ,255,0,0,1 GR.CIRCLE       dum, 0,0,0 ARRAY.LOAD      vib1[],0,20 ARRAY.LOAD      vib2[],0,10 ! colors ---------------------- GR.TEXT.SIZE    rad*1.4 GR.SET.STROKE   4 GR.TEXT.ALIGN   2 GR.TEXT.BOLD    1 GR.COLOR        255, 40  , 00  , 140 , 1  GR.COLOR        255, 120 , 120 , 255 , 0  GR.COLOR        255, 00  , 00  , 45  , 0 GR.COLOR        255, 255 , 120 , 120 , 1 GR.COLOR        255, 90  , 20  , 10  , 1 GR.PAINT.GET    colorIdx ! create button grid ---------- DIM             ctrl[nctrl] kx            = 2*rad*1.35 ky            = 2*rad*1.1 FOR i         = 0 TO nctrl-1 x            = 50  + MOD(i,nCols) *kx  + MOD(INT(i/nCols),2) *kx/2 y            = 150 + INT(i/nCols) *ky  ctrl[i+1]    = circButCreate (x, y ,rad, colorIdx,CHR$(48+i)) NEXT ! text bar for feedback ------- GR.TEXT.ALIGN   1 GR.TEXT.SIZE    50 GR.COLOR        255, 120,120,255,1 GR.TEXT.DRAW    txt1, 50, 60 ,"--" GR.RENDER RETURN ! ------------------------ !------------------------ userfun: FN.DEF          circButCreate (x,y,rad, color, txt$)      FOR i        = 1 TO 3   GR.CIRCLE     nn,x,y,rad   GR.MODIFY     nn, "paint" , color +i -5 NEXT GR.MOVE        nn, 1 , 1 GR.TEXT.DRAW   nn, x,y+rad*0.5,txt$ GR.MODIFY      nn, "paint" , color  -1 GR.TEXT.DRAW   nn, x,y+rad*0.5,txt$ GR.MOVE        nn, 2 , 2 FN.RTN         nn-4 FN.END RETURN !------------------------ !===========================================