#include #include "screen.h" #include "console.h" #include "tools.h" #include "charmap.h" #include "touchpad.h" #include "config.h" int col=0; int line=0; int prx=-1; int pry=-1; void endProgress() { drwStr(prx*CHAR_WIDTH,pry*CHAR_HEIGHT," ",0); prx=-1; pry=-1; } void setProgress(int val) { char tmp[4]; itoa(tmp,val,10); if(prx>=0) drwStr(prx*CHAR_WIDTH,pry*CHAR_HEIGHT,tmp,0); } void initProgress(int x, int y, int val) { prx=x; pry=y; if(prx>=0) drwStr(prx*CHAR_WIDTH,pry*CHAR_HEIGHT," %",0); setProgress(val); } void disp( char* message, int ret ) { int l = strlen(message); int i, stop=0; for (i = 0; i < l && !stop; i++) { if (message[i] == 0x0A) { if ( ret ) { col = 0; line ++; } else { putChar(col*CHAR_WIDTH, line*CHAR_HEIGHT, ' '); col++; } } else { putChar(col*CHAR_WIDTH, line*CHAR_HEIGHT, message[i]); col ++; } if (col > MAX_COL || (col==MAX_COL && ret) ) { if ( !ret ) stop=1; else { col = 0; line ++; } } if(line>=MAX_LGN) { line=0; clrScr(); } } } void dispc(char c, int ret) { char tmp[2]=" "; tmp[0]=c; disp(tmp,ret); } void dispi(int i, int ret) { char tmp[NBR_SIZE]; itoa(tmp,i,10); disp(tmp,ret); } void displn( char* message, int ret ) { disp(message, ret); col=0; line++; if(line>=MAX_LGN) { line=0; clrScr(); } } void pause( char* message, int ret, int invite ) { if(message) displn(message, ret); if(invite) { disp("Press ",0); #ifdef TOUCHPAD_SUPPORT disp("/ Touch ",0); #endif #ifdef ANYKEY_SUPPORT disp("anything ",0); #else disp("esc ",0); #endif displn("to continue...", 0); } initTP(); do { wait(100); readTP(); } while( #ifdef ANYKEY_SUPPORT !any_key_pressed() #else !isKeyPressed(KEY_NSPIRE_ESC) #endif && !isTPTouched() ); do { wait(100); readTP(); } while( #ifdef ANYKEY_SUPPORT any_key_pressed() #else isKeyPressed(KEY_NSPIRE_ESC) #endif || isTPTouched() ); endTP(); } void resetConsole() { col=0; line=0; }