void ofxPanel::loadIcons(){ unsigned char loadIconData[] = {0x38,0x88,0xa,0x6,0x7e,0x60,0x50,0x11,0x1c}; unsigned char saveIconData[] = {0xff,0x4a,0x95,0xea,0x15,0xa8,0x57,0xa9,0x7f}; loadIcon.allocate(9, 8, OF_IMAGE_COLOR_ALPHA); saveIcon.allocate(9, 8, OF_IMAGE_COLOR_ALPHA); loadStencilFromHex(loadIcon, loadIconData); loadStencilFromHex(saveIcon, saveIconData); loadIcon.getTextureReference().setTextureMinMagFilter(GL_NEAREST,GL_NEAREST); saveIcon.getTextureReference().setTextureMinMagFilter(GL_NEAREST,GL_NEAREST); }
void ofxPanel::draw(){ if(!loadIcon.isAllocated() || !saveIcon.isAllocated()){ unsigned char loadIconData[] = {0x38,0x88,0xa,0x6,0x7e,0x60,0x50,0x11,0x1c}; unsigned char saveIconData[] = {0xff,0x4a,0x95,0xea,0x15,0xa8,0x57,0xa9,0x7f}; loadIcon.allocate(9, 8, OF_IMAGE_COLOR_ALPHA); saveIcon.allocate(9, 8, OF_IMAGE_COLOR_ALPHA); loadStencilFromHex(loadIcon, loadIconData); loadStencilFromHex(saveIcon, saveIconData); } int iconSpacing = 6; loadBox.x = b.width - (loadIcon.getWidth() + saveIcon.getWidth() + iconSpacing + textPadding); loadBox.y = header / 2 - loadIcon.getHeight() / 2; loadBox.width = loadIcon.getWidth(); loadBox.height = loadIcon.getHeight(); saveBox.set(loadBox); saveBox.x += loadIcon.getWidth() + iconSpacing; ofPushStyle(); ofPushMatrix(); currentFrame = ofGetFrameNum(); ofTranslate(b.x, b.y); ofFill(); ofSetColor(headerBackgroundColor); ofRect(0, 0, b.width, header); ofSetColor(textColor); ofDrawBitmapString(name, textPadding, header / 2 + 4); ofPushMatrix(); loadIcon.draw(loadBox.x, loadBox.y); saveIcon.draw(saveBox.x, saveBox.y); ofPopMatrix(); for(int i = 0; i < (int)collection.size(); i++){ collection[i]->draw(); } ofPopMatrix(); ofPopStyle(); }