int OUTPUTXSIZE = 90; int OUTPUTYSIZE = 120; int OUTPUTXSPACE = 10; int XSIZE = 10; int YSIZE = 14; int XSPACE = 2; int BGGREY= 60; int MARGIN=20; int NUMCHARS = 12; int FONTXSIZE = 3; int FONTYSIZE = 5; String typingBuff = ""; String outputBuff=""; int[] CharMap = new int[128]; charImage[] alphabetFont = new charImage[128]; charImage letter; void setup() { size((NUMCHARS*OUTPUTXSIZE+(NUMCHARS-1)*OUTPUTXSPACE)+2*MARGIN, 3*MARGIN+OUTPUTYSIZE+YSIZE); background(BGGREY); // loadSSDImages(); // initCharMapping(); initAlphabetFont(); /* for(i=0;i<128;i++) putChar(i, (i%16)*30, (i/16)*40);*/ // alphabetFont[0].update(0,0, 10, 10); // letter.update(0,0,5,7); }; void initAlphabetFont() { for (int i=0; i<128; i++) alphabetFont[i] = new charImage(); // 0 int[] letterImage = new int[] { 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0 }; alphabetFont[48] = new charImage(letterImage); alphabetFont[48].update(0,0, XSIZE, YSIZE); //background(BGGREY); // 1 letterImage = new int[] { 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1 }; alphabetFont[49] = new charImage(letterImage); alphabetFont[49].update(0,0,5,5); background(BGGREY); // 2 letterImage = new int[] { 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1 }; alphabetFont[50] = new charImage(letterImage); alphabetFont[50].update(0,0,5,5); background(BGGREY); // A letterImage = new int[] { 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1 }; alphabetFont[65] = new charImage(letterImage); alphabetFont[65].update(0,0,5,5); background(BGGREY); // B letterImage = new int[] { 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0 }; alphabetFont[66] = new charImage(letterImage); alphabetFont[66].update(0,0,5,5); background(BGGREY); // C letterImage = new int[] { 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1 }; alphabetFont[67] = new charImage(letterImage); alphabetFont[67].update(0,0,5,5); background(BGGREY); // D letterImage = new int[] { 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0 }; alphabetFont[68] = new charImage(letterImage); alphabetFont[68].update(0,0,5,5); background(BGGREY); // E letterImage = new int[] { 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1 }; alphabetFont[69] = new charImage(letterImage); alphabetFont[69].update(0,0,5,5); background(BGGREY); // F letterImage = new int[] { 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0 }; alphabetFont[70] = new charImage(letterImage); // G letterImage = new int[] { 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1 }; alphabetFont[71] = new charImage(letterImage); // H letterImage = new int[] { 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1 }; alphabetFont[72] = new charImage(letterImage); // I letterImage = new int[] { 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 1 }; alphabetFont[73] = new charImage(letterImage); // J letterImage = new int[] { 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0 }; alphabetFont[74] = new charImage(letterImage); // K letterImage = new int[] { 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1 }; alphabetFont[75] = new charImage(letterImage); // L letterImage = new int[] { 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1 }; alphabetFont[76] = new charImage(letterImage); // M letterImage = new int[] { 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1 }; alphabetFont[77] = new charImage(letterImage); // N letterImage = new int[] { 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 1 }; alphabetFont[78] = new charImage(letterImage); // O letterImage = new int[] { 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0 }; alphabetFont[79] = new charImage(letterImage); // P letterImage = new int[] { 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0 }; alphabetFont[80] = new charImage(letterImage); // Q letterImage = new int[] { 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1 }; alphabetFont[81] = new charImage(letterImage); // R letterImage = new int[] { 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1 }; alphabetFont[82] = new charImage(letterImage); // S letterImage = new int[] { 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0 }; alphabetFont[83] = new charImage(letterImage); // T letterImage = new int[] { 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0 }; alphabetFont[84] = new charImage(letterImage); // U letterImage = new int[] { 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1 }; alphabetFont[85] = new charImage(letterImage); // V letterImage = new int[] { 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0 }; alphabetFont[86] = new charImage(letterImage); // W letterImage = new int[] { 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, }; alphabetFont[87] = new charImage(letterImage); // X letterImage = new int[] { 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1 }; alphabetFont[88] = new charImage(letterImage); // Y letterImage = new int[] { 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0 }; alphabetFont[89] = new charImage(letterImage); // Z letterImage = new int[] { 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 1, 1 }; alphabetFont[90] = new charImage(letterImage); }; void putChar(int charIndex, int xpos, int ypos) { alphabetFont[charIndex].update(xpos, ypos, XSIZE, YSIZE); } void putChar(int charIndex, int xpos, int ypos, int xsize, int ysize) { alphabetFont[charIndex].update(xpos, ypos, xsize, ysize); } void draw() { //background(0); int charIndex; char k; // display current typing buffer at bottom of screen for(int i=0;i0){ typingBuff = typingBuff.substring(1); } background(BGGREY); break; case ENTER: // Avoid special keys case RETURN: sendBuffToDisplay(); break; case 65535: case 127: case 27: break; default: if(typingBuff.length()