Code:
LOCAL CRID:="FINGERSPELLER © 2016 StephenG1CMZ"+CHAR(10);
LOCAL TRANSLATED:="";
LOCAL WORLD:="Hello World © 2016";
//CUSTOMISE
LOCAL SECS:=1; //0=KEY WAIT
LOCAL CHEAT_MODE:=1; //0 , 1
//USE: G7
LOCAL Y0:=20;//HEADER HEIGHT
//FULL VALUES:
//LOCAL FWIN:={0,Y0,320,200,0,220,320,220};//200-220 FOR CHEAT LINE
LOCAL FWIN:={320/2,Y0,320,200,0,200,320,220};
//USER VALUES MAY BE SMALLER TO SHARE SCREEN
LOCAL SZX:=320;
LOCAL SZY:=220-Y0;
LOCAL II,JJ,OKC;
LOCAL ROWS:=5;
LOCAL COLS:=6;
//LOCAL MYPX;
LOCAL FS:={};
LOCAL FSTMP:="TempFingerspell";
LOCAL CHARSET:="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
LOCAL STRNG:="";
LOCAL FILESPEC:="";
SCR_PUT()
BEGIN
AFiles(FSTMP):=G0;//SAVE
END;
SCR_GET()
BEGIN
G0:=AFiles(FSTMP);
DelAFiles(FSTMP);//Garbage Gone
END;
BSL(ACT)
BEGIN
RECT_P();
CASE
IF ACT=="D" THEN
//USE DEL FOR CLEAN BUILD
//CANCEL MAY MIX OLD AND NEWFILES
TEXTOUT_P(AFiles(),0,20);WAIT(1);
OKC:=MSGBOX("Delete OLD BSL?",1);
END;
IF ACT=="B" THEN
//BUILD FILES REPLACING THOSE EXISING
OKC:=MSGBOX("Build BSL?",1);
IF OKC THEN
RECT_P();
//TEXTOUT_P("Building BSL",0,SZY/2);
//SIZE OF DIMGROB MUST BE BIG ENOUGH FOR PNG DATA
//(IF 320 ASSUMED YOUR TEST TEXT CAN BE SMALL)
DIMGROB_P(G7,22+2,28+20);
//MSGBOX("XY"+GROBW_P(G7));//SYSCHECK:GROBW≤320:
END;
END;
IF ACT=="S" THEN END;
DEFAULT
END;
FOR II FROM 1 TO 26 DO
FS(II):="BSL_"+CHAR(ASC("A")+II-1);
END;
//MSGBOX(FS);
CASE
IF ACT=="D" AND OKC THEN
FOR II FROM 1 TO 26 DO
DelAFiles(FS(II));
END;
DelAFiles("BSL");
END;
IF ACT=="B" AND OKC THEN //BUILD
FOR II FROM 1 TO 26 DO
RECT_P(G7);
//TEXTOUT_P(CHAR(ASC("A")+II-1),G7,SZX/2,SZY/2,7);
TEXTOUT_P(CHAR(ASC("A")+II-1),G7,2,20,7);
BLIT_P(G0,G7); //MAYBE SLOW ENOUGH TO SEE PROGRESS
AFiles(FS(II)):=G7; //CAN BE SLOW IF SAVING FULLSCREEN
//WAIT(1);
END;
AFiles("BSL"):=CHARSET;//DOCUMENT THE INSTALLATION
END;
IF ACT=="S" AND OKC THEN //SHOW
RECT_P();
FOR II FROM 1 TO 26 DO
//IF AFiles(FS) THEN //IF IT EXISTS-
//RTE IF IT DOESNT
G0:=AFiles(FS(II));//TOO FAST TO SEE
//WAIT(SECS);
END;
END;
DEFAULT
END;
END;
SHOWAZ ()
BEGIN
LOCAL XX:=IP(SZX/COLS);
LOCAL YY:=IP(SZY/ROWS);
//LOCAL LIN;
LOCAL CN,XXX,YYY;
RECT_P(0,20,320,240);
FOR II FROM 0 TO ROWS-1 DO
FOR JJ FROM 0 TO COLS-1 DO
CN:=COLS*II+JJ+1;//6
//MSGBOX(CN);
IF CN≤26 THEN
FS(CN):="BSL_"+CHAR(ASC("A")+CN-1);//MUST MATCH BUILD
XXX:={JJ*XX,(JJ+1)*XX};
YYY:={II*YY+Y0,(II+1)*YY+Y0};
//MSGBOX(CN);
G7:=AFiles(FS(CN));
//BLIT_P(G0,XXX(1),YYY(1),XXX(2),YYY(2),G7,MIDX-2,MIDY-0,MIDX+20,MIDY+28);
BLIT_P(G0,XXX(1),YYY(1),XXX(2),YYY(2),G7,0,20,GROBW_P(G7),GROBH_P(G7));
RECT_P(XXX(1),YYY(1),XXX(2),YYY(2),0,{#FFFFFFh,0});
//WAIT;
END;
END;
END;
DRAWMENU("BSL");
TEXTOUT_P("BSL"+"- IMAGINE FINGERSPELL DATA HERE",0,0);
END;
DISPLAY_ONE (ST)
BEGIN
LOCAL CH:=MID(ST,1,1);
RECT_P(G7,0,20,320,200);//PROB NOT NEEDED:DEFINED BY FILE
G7:=AFiles("BSL_"+CH);
BLIT_P(G0,FWIN(1),FWIN(2),FWIN(3),FWIN(4),G7,0,20,GROBW_P(G7),GROBH_P(G7));
WAIT(SECS);
END;
DO_FSPELL(ST,TOPCALL)
//AVOID SCREENSAVING HERE
//IDEALLY: EARLY COMPLETION TBD
BEGIN
LOCAL CH;
IF TOPCALL THEN
//REPLACE & WITH fspelldo("AND",0) ETC TBD
//(DONT REPLACE STRING)
END;
//ESCAPE IF GETKEY4 AND SECS≠0?TBD
FOR II FROM 1 TO DIM(ST) DO
CH:=UPPER(MID(ST,II,1));
IF INSTRING(CHARSET,CH) THEN
IF TOPCALL THEN
RECT_P(FWIN(1),FWIN(2),FWIN(3),FWIN(4));
RECT_P(FWIN(5),FWIN(6),FWIN(7),FWIN(8));
IF CHEAT_MODE THEN //SHOW STRING PROGRESS IN USER STRING
//IMPROVES READABILITY BUT WILL WANT TO CUSTOMISE OUT IN TESTS
TEXTOUT_P(MID(ST,1,II),FWIN(5)+2,FWIN(6));
DRAWMENU(II,DIM(ST));
ELSE
DRAWMENU("");
//(OTHERWISE USER MENU IS SEEN BUT NOT RESPONDED TO )
END;
END;
DISPLAY_ONE(CH);
ELSE
//IGNORE UNKNOWN CHARS
END;
END;
END;
EXPORT FINGERSPELL(STRNG)
//STRINGS(OR FILES)
BEGIN
LOCAL ST:=STRNG;
IF DIM(ST) THEN
//DO DISPLAY
SCR_PUT();
DO_FSPELL(ST,1);
SCR_GET();
END;
END;
EXPORT FINGERSPELL_s(SECONDS)
//WAIT
BEGIN
SECS:=SECONDS;
END;
FINGERSPELL_BUILDER_TEST()
BEGIN
OKC:=MSGBOX(CRID+"Instal Test Data (May Delete Old Signs)?",1);
IF OKC THEN
BSL("D");//DEL OLDFILES?
BSL("B");//BUILD NEW FILES?
MSGBOX(AFiles);
END;
END;
FINGERSPELL_IN ()
BEGIN
LOCAL TTL:=CRID;
LOCAL LBL:={"String","File"};
LOCAL HLP:={"Enter String to Fingerspell","Enter File to Fingerspell"};
LOCAL ST:={};
OKC:=INPUT({{STRNG,[2]},{FILESPEC,[2]}},TTL,LBL,HLP,{"",""},{STRNG,FILESPEC});
IF OKC THEN
IF DIM(FILESPEC) THEN
STRNG:=STRNG+EXPR(FILESPEC);
END;
FINGERSPELL(STRNG);
END;
RETURN STRNG;
END;
EXPORT TranslateDeFinger()
BEGIN
MSGBOX("TBD");
END;
EXPORT TranslateToFinger()
BEGIN
TRANSLATED:=FINGERSPELL_IN();
RETURN TRANSLATED;
END;
EXPORT FINGERSPELL_SetWin(WINLIST)
//1-4: WINDOW FOR GRAPHIC
//5-8: WINDOW FOR CHEATLINE
//OVERLAP: CHEATLINE OBSCURED
//INTENDED FOR USE BY USER PROGRAMS FOR SCREEN SHARING
BEGIN
FWIN:=WINLIST;
END;
EXAMPLE_HELLO_WORLD()
BEGIN
//AN EXAMPLE:HELLO WORLD
//FIRST SET UP AN EXAMPLE PROGRAM SCREEN AS BACKGROUND
//TO DEMONSTRATE WITH
RECT_P(0,20,320,220);
TEXTOUT_P("EXAMPLE PROGRAM SCREEN...ACCESSIBLE",0,240/2);
TEXTOUT_P(WORLD,0,240/4);
DRAWMENU("Original");
WAIT(2);
//NOW DEMONSTRATE ACCESSIBLE USE
//OPTIONAL:BEST SET BY USER
FINGERSPELL_s(SECS);
//OPTIONAL:BEST SET BY USER PROGRAM
FINGERSPELL_SetWin({320/2,Y0,320,200,0,200,320,220});
//FINGERSPELL_SetWin({320/2,Y0,320,100,0,20,20,22});
//END OPTIONAL
FINGERSPELL(WORLD);
//END ACCESSIBLE
//EXAMPLE USER SCREEN RESTORED
END;
EXPORT FINGERSPELLER()
BEGIN
//INSTAL GRAPHICS (ONCE IN EACH APP NEEDED)
FINGERSPELL_BUILDER_TEST();
//SHOW THE GRAPHICS
BSL("S");//SHOW CURRENT DATA 1 BY 1
SHOWAZ();//SHOW ALPHABET PAGE
WAIT(SECS);WAIT(2);
EXAMPLE_HELLO_WORLD();
FREEZE;
END;