int statusTranslateY = 0; int statusBarMoveSpeed = 5; void drawStatusBar() { //background rectangle noStroke(); rectMode(CORNER); fill(212, 10, 50); rect(0, treemapHeight + 5, width, statusBarHeight); translate(0, statusTranslateY); boolean loaded = true; if (selectedItem != null) { ArrayList displayRGList = selectedItemRGs; int imageX = 6, imageY = treemapHeight + 11; int maxImageHeight = 0; for (Integer levelIndex : displayRGList) { loaded = imageLoaded(levelIndex); if (levelIndex >= 0 && levelIndex < numberRGs) { PImage rg = getRGImage(levelIndex); if (imageX + rg.width > width - scrollBarWidth) { imageX = 6; imageY = imageY + maxImageHeight + 6; maxImageHeight = 0; } image(rg, imageX, imageY); if (!loaded) { break; } noFill(); stroke(0); strokeWeight(2); rect(imageX, imageY, rg.width, rg.height); noStroke(); imageX = imageX + rg.width + 3; if (rg.height > maxImageHeight) { maxImageHeight = rg.height; } } } } translate(0, -statusTranslateY); if (!loaded) { //draw a ... to show that it's still loading fill(212, 30, 10, 60); String loadingText = "Loading..."; float txtWidth = textWidth(loadingText); float txtHeight = textAscent() + textDescent(); rect(width - scrollBarWidth - txtWidth - 5, height - txtHeight - 5, txtWidth + 5, txtHeight + 5); fill(212, 30, 10); text(loadingText, width - scrollBarWidth - txtWidth, height - 5); //ellipse(width - scrollBarWidth - 25, height - 10, 5, 5); //ellipse(width - scrollBarWidth - 15, height - 10, 5, 5); //ellipse(width - scrollBarWidth - 5, height - 10, 5, 5); } //draw the border rectangle fill(212, 30, 10); rect(0, treemapHeight, width, 5); //draw the scroll bar int buttonHeight = (statusBarHeight-5)/2; fill(212, 10, 80); stroke(212, 10, 10); strokeWeight(1); rect(width - scrollBarWidth, treemapHeight + 4, scrollBarWidth, buttonHeight); rect(width - scrollBarWidth, treemapHeight + buttonHeight + 5, scrollBarWidth, buttonHeight); line(width - scrollBarWidth/2, treemapHeight + 4 + buttonHeight/3, width - scrollBarWidth/2, treemapHeight + 4 + 2*buttonHeight/3); line (width - scrollBarWidth/4, treemapHeight + 4 + buttonHeight/2, width - scrollBarWidth/2, treemapHeight + 4 + buttonHeight/3); line (width - 3*scrollBarWidth/4, treemapHeight + 4 + buttonHeight/2, width - scrollBarWidth/2, treemapHeight + 4 + buttonHeight/3); line(width - scrollBarWidth/2, treemapHeight + buttonHeight + 5 + buttonHeight/3, width - scrollBarWidth/2, treemapHeight + buttonHeight + 5 + 2*buttonHeight/3); line (width - scrollBarWidth/4, treemapHeight + buttonHeight + 5 + buttonHeight/2, width - scrollBarWidth/2, treemapHeight + buttonHeight + 5 + 2*buttonHeight/3); line (width - 3*scrollBarWidth/4, treemapHeight + buttonHeight + 5 + buttonHeight/2, width - scrollBarWidth/2, treemapHeight + buttonHeight + 5 + 2*buttonHeight/3); //figure out how much we should be translating by if (mousePressed && mouseY > treemapHeight + 5 && mouseX > width - scrollBarWidth) { if (mouseY < treemapHeight + buttonHeight + 5) { statusTranslateY += statusBarMoveSpeed; } else { statusTranslateY -= statusBarMoveSpeed; } if (statusTranslateY > 0) { statusTranslateY = 0; } } rectMode(CORNERS); }