Example #1
0
void sideBar::draw(){
	if(Open){
		roundedShadow(x+20,y,w,h,h/2,.5);
		roundedBox(x,y,w,h,h/2,.5,.5,.52);
		roundedBox(x+(yo-y),y,w,h,h/2,r,g,b);
		ofSetColor(255, 255, 255);
		arialHeader.drawString(filename,x+w/4,y+3*h/4);
	}
	else {
		roundedBox(x,y,w,h,h/4,.5,.5,.52);
		roundedBox(x-200,y,w,h,h/4,r,g,b);
		ofSetColor(255, 255, 255);
		arialHeader.drawString(filename,x+w/4,y+3*h/4);
	}
}
Example #2
0
static void
buttonDraw(cairo_t* cr, const Button* but)
{
	// Draw base
	if (but->pressed) {
		cairo_set_source_rgba(cr, 0.4, 0.9, 0.1, 1);
	} else {
		cairo_set_source_rgba(cr, 0.3, 0.5, 0.1, 1);
	}
	roundedBox(cr, but->x, but->y, but->w, but->h);
	cairo_fill_preserve(cr);

	// Draw border
	cairo_set_source_rgba(cr, 0.4, 0.9, 0.1, 1);
	cairo_set_line_width(cr, 4.0);
	cairo_stroke(cr);

	// Draw label
	cairo_text_extents_t extents;
	cairo_set_font_size(cr, 32.0);
	cairo_text_extents(cr, but->label, &extents);
	cairo_move_to(cr,
	              (but->x + but->w / 2) - extents.width / 2,
	              (but->y + but->h / 2) + extents.height / 2);
	cairo_set_source_rgba(cr, 0, 0, 0, 1);
	cairo_show_text(cr, but->label);
}