void guiPopup(char* title, char* line1, char* line2, char* line3, char* button1, char* button2, bool closeonly) { //Prints a dark grey rectangle! drawFillRect(36, 60, 272, 85, 128, 128, 128, screenBottom); //Prints a light grey rectangle! drawFillRect(36, 85, 272, 189, 160, 160, 160, screenBottom); //Prints text gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, title, 124, 240 - fontDefault.height * 5); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, line1, 50, 245 - fontDefault.height * 7); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, line2, 50, 245 - fontDefault.height * 8); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, line3, 50, 245 - fontDefault.height * 9); //Prints the buttons! if (closeonly) { drawFillRect(107, 155, 198, 183, 192, 192, 192, screenBottom); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, button1, 130, 240 - fontDefault.height * 11); } else { drawFillRect(50, 151, 141, 179, 192, 192, 192, screenBottom); drawFillRect(166, 151, 257, 179, 192, 192, 192, screenBottom); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, button1, 60, 240 - fontDefault.height * 11); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, button2, 180, 240 - fontDefault.height * 11); } }
void guiBottomMenu() { //Prints a background! drawFillRect(0, 0, 320, 240, 166, 221, 238, screenBottom); //Prints the buttons drawFillRect(9, 6, 92, 33, 192, 192, 192, screenBottom); drawFillRect(220, 6, 303, 33, 192, 192, 192, screenBottom); drawFillRect(14, 68, 302, 131, 51, 153, 255, screenBottom); drawFillRect(14, 149, 302, 212, 255, 0, 0, screenBottom); //Prints the text sprintf(buffer, "About"); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, buffer, 30, 245- fontDefault.height * 2); sprintf(buffer, " Debug"); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, buffer, 235, 245 - fontDefault.height * 2); sprintf(buffer, "START PAINTING"); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, buffer, 108, 240 - fontDefault.height * 6); sprintf(buffer, "Start painting right now!"); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, buffer, 88, 240 - fontDefault.height * 7); sprintf(buffer, "EXIT 3DS PAINT"); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, buffer, 110, 240 - fontDefault.height * 11); sprintf(buffer, "Go back to homebrew launcher"); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, buffer, 70, 240 - fontDefault.height * 12); sprintf(buffer, "or 3DS Main Menu"); gfxDrawText(GFX_BOTTOM, GFX_LEFT, NULL, buffer, 100, 240 - fontDefault.height * 13); }
int GUI_BookIntro() { drawFillRect(40, 20 + bookintro_animation, 359, 239 , 255, 255, 255, screenTopLeft); drawFillRect(0, 0, 319, 220 - bookintro_animation, 255, 255, 255, screenBottom); if(!bookintro_animation) { bookintro_animation = 220; return 0; } else bookintro_animation-=20; return 1; }
void GUI_OptionsUi(bool greyScale) { gfxDrawSprite(GFX_BOTTOM, GFX_LEFT, (u8*)Options_bin, 171, 291, 14, 46); if (greyScale) //Color selection { drawFillRect(54, 176, 144, 184, 192, 192, 192, screenBottom); } else { drawFillRect(172, 176, 263, 184, 192, 192, 192, screenBottom); } }
void guiTopMenu() { //Prints the background! drawFillRect(0, 0, 399, 239, 166, 221, 238, screenTopLeft); //Prints the DPAD drawFillRect(23, 54, 68, 205, 255, 255, 255, screenTopLeft); drawFillRect(0, 110, 120, 153, 255, 255, 255, screenTopLeft); drawFillRect(0, 129, 17, 134, 166, 221, 238, screenTopLeft); drawFillRect(42, 69, 48, 106, 166, 221, 238, screenTopLeft); drawFillRect(72, 129, 107, 134, 166, 221, 238, screenTopLeft); drawFillRect(42, 159, 48, 196, 166, 221, 238, screenTopLeft); //Blue rect drawFillRect(254, 37, 399, 100, 51, 153, 255, screenTopLeft); //Text sprintf(buffer, "3DS Paint"); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 265, 230 - fontDefault.height * 3); sprintf(buffer, "Coded by"); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 265, 240 - fontDefault.height * 5); sprintf(buffer, "AlbertoSONIC"); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 265, 240 - fontDefault.height * 6); }
void main() { lcdInit(); spiOn(); spiOff(); sendByte(out); sendArray(array); lcdOn(); lcdOff(); sendBuffer(); sendPart(3, 7, LCD_Buffer); clear(); clearPart(5, 76); clearPartColor(5, 76, clBLACK); setPenColor(clBLACK); setBackColor(clWHITE); delay_nsek(40); scsOn(); scsOff(); i = getValue(LCD_Buffer, 23, 266); setValue(LCD_Buffer, 23, 266, 0x3F); setCharge(); resetCharge(); drawPixel(5, 5, LCD_Buffer); drawVLine(5, 5, 5, LCD_Buffer); drawHLine(5, 5, 5, LCD_Buffer); drawLine(5, 5, 55, 55, LCD_Buffer); drawRect(5, 5, 55, 55, LCD_Buffer); drawFillRect(5, 5, 55, 55, clWHITE, LCD_Buffer); drawCircle(10, 10, 5, LCD_Buffer); }
void GUI_FileExplorer(){ if (count != 0) { int n = 0; int divisions = count % 10 == 0 ? count / 10 : count / 10 + 1; int list[divisions]; for (n = 0; n < divisions; n++) { if (n == divisions - 1 && count % 10 != 0)list[n] = count - (count / 10) * 10; else list[n] = 10; } int i = 0; itemShown = list[(pointer / 10)]; for (i = beginning; i < beginning + list[(pointer / 10)]; i++) { char filename[100]; strcpy(filename, files[i]); if (strlen(filename)>39) { filename[39] = '\0'; strcat(filename, "..."); } sprintf(buffer, "%s%s", i == pointer ? "> " : "", filename); if (pointer == i) drawFillRect(35, fontBlack.height * (i - beginning + 1), 275, fontBlack.height * (i - beginning + 1) + 15, 226, 226, 226, screenBottom); gfxDrawText(GFX_BOTTOM, GFX_LEFT, &fontBlack, filename, 40, 238 - fontBlack.height * (i - beginning + 1) - 15); } //Draw the next/prev page button if there's one if (beginning != 0) gfxDrawSprite(GFX_BOTTOM, GFX_LEFT, (u8*)PrevFM_bin, 71, 23, 9, 109); // <-- if (count > beginning + 10) gfxDrawSprite(GFX_BOTTOM, GFX_LEFT, (u8*)NextFM_bin, 72, 22, 289, 109); // --> } }
void guiClock() { //CLOCK drawFillRect(276, 196, 399, 219, 255, 0, 0, screenTopLeft); u64 timeInSeconds = osGetTime() / 1000; u64 dayTime = timeInSeconds % SECONDS_IN_DAY; sprintf(buffer, "%.2llu:%.2llu:%.2llu", dayTime / SECONDS_IN_HOUR, (dayTime % SECONDS_IN_HOUR) / SECONDS_IN_MINUTE, dayTime % SECONDS_IN_MINUTE); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 300, 248 - fontDefault.height * 14); }
void guiTopAnimation() { //Prints the brown background! drawFillRect(0, 0, 399, 239, 255, 185, 15, screenTopLeft); //Prints the DPAD drawFillRect(23, 54, 68, 205, 255, 255, 255, screenTopLeft); drawFillRect(0, 110, 120, 153, 255, 255, 255, screenTopLeft); drawFillRect(0, 129, 17, 134, 242, 204, 146, screenTopLeft); drawFillRect(42, 69, 48, 106, 242, 204, 146, screenTopLeft); drawFillRect(72, 129, 107, 134, 242, 204, 146, screenTopLeft); drawFillRect(42, 159, 48, 196, 242, 204, 146, screenTopLeft); //Blue rect drawFillRect(254, 37, 399, 100, 51, 153, 255, screenTopLeft); //Green rect (save) drawFillRect(257, 138, 399, 168, 69, 206, 48, screenTopLeft); //Text sprintf(buffer, "More fps"); gfxDrawText(GFX_TOP, GFX_RIGHT, NULL, buffer, 27, 240 - fontDefault.height * 3); sprintf(buffer, "3DS Paint"); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 265, 230 - fontDefault.height * 3); sprintf(buffer, "Coded by"); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 265, 240 - fontDefault.height * 5); sprintf(buffer, "AlbertoSONIC and norips"); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 265, 240 - fontDefault.height * 6); sprintf(buffer, "Less fps"); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 27, 240 - fontDefault.height * 14); sprintf(buffer, "CHANGE COLOR"); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 130, 235 - fontDefault.height * 8); sprintf(buffer, "SELECT ERASER"); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 130, 235 - fontDefault.height * 9); sprintf(buffer, "Press SELECT to export"); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 265, 245 - fontDefault.height * 10); sprintf(buffer, "your anim to SDCARD"); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 265, 248 - fontDefault.height * 11); }
void guiDebug(int mode, int state, int color, int rendered, int sound, int printFPS, int posX, int posY) { //Todo drawFillRect(79, 163, 250, 239, 0, 0, 0, screenTopLeft); sprintf(buffer, "mode = %d state = %d", mode, state); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 85, 250 - fontDefault.height * 12); sprintf(buffer, "color = %d rendered = %d", color, rendered); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 85, 250 - fontDefault.height * 13); sprintf(buffer, "sound = %d FPS = %d", sound, printFPS); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 85, 250 - fontDefault.height * 14); sprintf(buffer, "TouchX = %d Touch = %d", posX, posY); gfxDrawText(GFX_TOP, GFX_LEFT, NULL, buffer, 85, 240 - fontDefault.height * 15); }
void guiBottomPaintAnimation(int cTable[][ctablesize],canvas* canvasarray,int frame, int fps) { //Prints a white screen! char buffer[256]; drawFillRect(0, 0, 320, 240, 255, 255, 255, screenBottom); if(canvasarray!=NULL) { int size=canvasarray->size; for(int i=0;i<size;i++) { drawPixel( canvasarray->point[i].x, canvasarray->point[i].y, cTable[canvasarray->point[i].color][0], cTable[canvasarray->point[i].color][1], cTable[canvasarray->point[i].color][2], screenBottom); } } sprintf(buffer,"FPS = %03d",fps); gfxDrawText(GFX_BOTTOM,GFX_LEFT,&fontBlack,buffer,5,235- fontDefault.height*2); }
void guiFrame() { drawFillRect(276, 169, 399, 200, 0, 204, 146, screenTopLeft); sprintf(buffer,"Frame = %03d/%03d",frame+1,canvassize+1); gfxDrawText(GFX_TOP, GFX_LEFT ,NULL, buffer, 300, 65 - fontDefault.height ); }
void guiBottomPaint(int color, int cTable[][ctablesize], char posxy[][posxysize],canvas* canvasarray) { //Prints a white screen! drawFillRect(0, 0, 320, 240, 255, 255, 255, screenBottom); //Prints the brown toolbar bar! drawFillRect(0, 0, 320, 34, 242, 204, 146, screenBottom); //Highlights the selected color if (color == 0) drawFillRect(15, 3, 50, 31, 160, 160, 160, screenBottom); if (color == 1) drawFillRect(84, 6, 106, 27, 160, 160, 160, screenBottom); if (color == 2) drawFillRect(118, 6, 140, 27, 160, 160, 160, screenBottom); if (color == 3) drawFillRect(152, 6, 174, 27, 160, 160, 160, screenBottom); if (color == 4) drawFillRect(186, 6, 208, 27, 160, 160, 160, screenBottom); if (color == 5) drawFillRect(220, 6, 242, 27, 160, 160, 160, screenBottom); if (color == 6) drawFillRect(254, 6, 276, 27, 160, 160, 160, screenBottom); if (color == 7) drawFillRect(288, 6, 310, 27, 160, 160, 160, screenBottom); //Prints the eraser, red part first, then the white one! drawFillRect(19, 8, 39, 26, 255, 0, 0, screenBottom); drawFillRect(39, 9, 46, 25, 255, 255, 255, screenBottom); //Prints 8 color boxes! guix1 = 87; guix2 = 103; for (box = 1; box < 8; box++) { drawFillRect(guix1, 9, guix2, 24, cTable[box][0], cTable[box][1], cTable[box][2], screenBottom); guix1 = guix1 + 34; guix2 = guix2 + 34; } //Print drawing for (guiy = 35; guiy < 240; guiy++) { for (guix = 0; guix < 320; guix++) { drawPixel(guix, guiy, cTable[posxy[guix][guiy]][0], cTable[posxy[guix][guiy]][1], cTable[posxy[guix][guiy]][2], screenBottom); } } if(canvasarray!=NULL && showLastFrame){ int size=canvasarray->size; for(int i=0;i<size;i++){ //No painting if(posxy[canvasarray->point[i].x][canvasarray->point[i].y]==0){ drawPixel(canvasarray->point[i].x, canvasarray->point[i].y, 96, 96, 96, screenBottom); } } } }
void GUI_TextView(char* path, int page, bool greyScale) { //Draw BKG gfxDrawSprite(GFX_TOP, GFX_LEFT, (u8*)TextBKG_bin, 240, 400, 0, 0); if (greyScale) { drawFillRect(40, 20, 359, 239, 255, 255, 255, screenTopLeft); drawFillRect(0, 0, 319, 239, 255, 255, 255, screenBottom); } else { drawFillRect(40, 20, 359, 239, 243, 231, 189, screenTopLeft); drawFillRect(0, 0, 319, 239, 243, 231, 189, screenBottom); } //Draw page sprintf(buffer, "PG: %i", page + 1); gfxDrawText(GFX_TOP, GFX_LEFT, &fontBlack, buffer, 5, 238 - fontBlack.height * 15); //Read the page int c; FILE *file; nextAvailable = true; file = fopen(path, "r"); if (file) { //Show bookmark (with animation) if (page == TextView_GetBookmark(path)) { if (bookmark_animation != 24) bookmark_animation+=4; } else bookmark_animation = 0; if(bookmark_animation != 0) drawFillRect(368, 20, 385, 20 + bookmark_animation, 255, 0, 0, screenTopLeft); //Start reading the page fseek(file, !page ? 4 : offsets[page], SEEK_SET); int i = 0; for (i = 0; i < 29; i++) { //Loads the line int j = 0; char line[55]; for (j = 0; j < 55; j++) { if ((c = getc(file)) != EOF && c != '\n') line[j] = c; else { if (c == EOF) nextAvailable = false; line[j] = '\0'; break; } } //Prints text gfxDrawText( i < 14 ? GFX_TOP : GFX_BOTTOM, GFX_LEFT, //Screen on which to print the text greyScale ? &fontBlack : &fontBrown, line, //Line of text to print i < 14 ? 44 : 5, //Horizzontal position of the text 238 - fontBlack.height * (i < 14 ? i + 2 : i + 1 - 14) //Vertical position of the text ); } //Save the current offset in file, for every page fflush(file); offsets[page+1] = ftell(file); fclose(file); } else { //Error } //Next/Previous Page buttons: if (page!=0) gfxDrawSprite(GFX_TOP, GFX_LEFT, (u8*)PrevPG_bin, 71, 23, 0, 85); // <-- if (nextAvailable) gfxDrawSprite(GFX_TOP, GFX_LEFT, (u8*)NextPG_bin, 72, 22, 378, 85); // --> }