static void selector_cb(void) { int i; char text[MAXPATHLEN]; int yoffset = 108; /* Initialize directory icon */ gui_image dir_icon; dir_icon.texture = gxTextureOpenPNG(Browser_dir_png,0); dir_icon.w = dir_icon.texture->width; dir_icon.h = dir_icon.texture->height; dir_icon.x = 26; dir_icon.y = (26 - dir_icon.h)/2; /* Initialize selection bar */ gui_image bar_over; bar_over.texture = gxTextureOpenPNG(Overlay_bar_png,0); bar_over.w = bar_over.texture->width; bar_over.h = bar_over.texture->height; bar_over.x = 16; bar_over.y = (26 - bar_over.h)/2; /* Draw browser array */ gxDrawRectangle(15, 108, 358, 26, 127, (GXColor)BG_COLOR_1); gxDrawRectangle(15, 134, 358, 26, 127, (GXColor)BG_COLOR_2); gxDrawRectangle(15, 160, 358, 26, 127, (GXColor)BG_COLOR_1); gxDrawRectangle(15, 186, 358, 26, 127, (GXColor)BG_COLOR_2); gxDrawRectangle(15, 212, 358, 26, 127, (GXColor)BG_COLOR_1); gxDrawRectangle(15, 238, 358, 26, 127, (GXColor)BG_COLOR_2); gxDrawRectangle(15, 264, 358, 26, 127, (GXColor)BG_COLOR_1); gxDrawRectangle(15, 290, 358, 26, 127, (GXColor)BG_COLOR_2); gxDrawRectangle(15, 316, 358, 26, 127, (GXColor)BG_COLOR_1); gxDrawRectangle(15, 342, 358, 26, 127, (GXColor)BG_COLOR_2); /* Draw Files list */ for (i = offset; (i < (offset + 10)) && (i < maxfiles); i++) { if (i == selection) { /* selection bar */ gxDrawTexture(bar_over.texture,bar_over.x,yoffset+bar_over.y,bar_over.w,bar_over.h,255); /* scrolling text */ if ((string_offset/SCROLL_SPEED) >= strlen(filelist[i].filename)) { string_offset = 0; } if (string_offset) { sprintf(text,"%s ",filelist[i].filename+string_offset/SCROLL_SPEED); strncat(text, filelist[i].filename, string_offset/SCROLL_SPEED); } else { strcpy(text, filelist[i].filename); } /* print text */ if (filelist[i].flags) { /* directory icon */ gxDrawTexture(dir_icon.texture,dir_icon.x,yoffset+dir_icon.y,dir_icon.w,dir_icon.h,255); if (FONT_write(text,18,dir_icon.x+dir_icon.w+6,yoffset+22,bar_over.w-dir_icon.w-26,(GXColor)WHITE)) { /* text scrolling */ string_offset ++; } } else { if (FONT_write(text,18,dir_icon.x,yoffset+22,bar_over.w-20,(GXColor)WHITE)) { /* text scrolling */ string_offset ++; } } } else { if (filelist[i].flags) { /* directory icon */ gxDrawTexture(dir_icon.texture,dir_icon.x,yoffset+dir_icon.y,dir_icon.w,dir_icon.h,255); FONT_write(filelist[i].filename,18,dir_icon.x+dir_icon.w+6,yoffset+22,bar_over.w-dir_icon.w-26,(GXColor)WHITE); } else { FONT_write(filelist[i].filename,18,dir_icon.x,yoffset+22,bar_over.w-20,(GXColor)WHITE); } } yoffset += 26; } gxTextureClose(&bar_over.texture); gxTextureClose(&dir_icon.texture); }
static void selector_cb(void) { int i; char text[MAXPATHLEN]; int yoffset = 108; /* Draw browser array */ gxDrawRectangle(15, 108, 358, 26, 127, (GXColor)BG_COLOR_1); gxDrawRectangle(15, 134, 358, 26, 127, (GXColor)BG_COLOR_2); gxDrawRectangle(15, 160, 358, 26, 127, (GXColor)BG_COLOR_1); gxDrawRectangle(15, 186, 358, 26, 127, (GXColor)BG_COLOR_2); gxDrawRectangle(15, 212, 358, 26, 127, (GXColor)BG_COLOR_1); gxDrawRectangle(15, 238, 358, 26, 127, (GXColor)BG_COLOR_2); gxDrawRectangle(15, 264, 358, 26, 127, (GXColor)BG_COLOR_1); gxDrawRectangle(15, 290, 358, 26, 127, (GXColor)BG_COLOR_2); gxDrawRectangle(15, 316, 358, 26, 127, (GXColor)BG_COLOR_1); gxDrawRectangle(15, 342, 358, 26, 127, (GXColor)BG_COLOR_2); /* Draw Files list */ for (i = offset; (i < (offset + 10)) && (i < maxfiles); i++) { if (i == selection) { /* selection bar */ gxDrawTexture(bar_over.texture,bar_over.x,yoffset+bar_over.y,bar_over.w,bar_over.h,255); /* scrolling text */ if ((string_offset/SCROLL_SPEED) >= strlen(filelist[i].filename)) { string_offset = 0; } if (string_offset) { sprintf(text,"%s ",filelist[i].filename+string_offset/SCROLL_SPEED); strncat(text, filelist[i].filename, string_offset/SCROLL_SPEED); } else { strcpy(text, filelist[i].filename); } /* print text */ if (filelist[i].flags) { /* directory icon */ gxDrawTexture(dir_icon.texture,dir_icon.x,yoffset+dir_icon.y,dir_icon.w,dir_icon.h,255); if (FONT_write(text,18,dir_icon.x+dir_icon.w+6,yoffset+22,bar_over.w-dir_icon.w-26,(GXColor)WHITE)) { /* text scrolling */ string_offset ++; } } else { if (FONT_write(text,18,26,yoffset+22,bar_over.w-20,(GXColor)WHITE)) { /* text scrolling */ string_offset ++; } } } else { if (filelist[i].flags) { /* directory icon */ gxDrawTexture(dir_icon.texture,dir_icon.x,yoffset+dir_icon.y,dir_icon.w,dir_icon.h,255); FONT_write(filelist[i].filename,18,dir_icon.x+dir_icon.w+6,yoffset+22,bar_over.w-dir_icon.w-26,(GXColor)WHITE); } else { FONT_write(filelist[i].filename,18,26,yoffset+22,bar_over.w-20,(GXColor)WHITE); } } yoffset += 26; } }