static void menubar_draw_drop (WMenuBar * menubar) { const Menu *menu = g_list_nth_data (menubar->menu, menubar->selected); const unsigned int count = g_list_length (menu->entries); int column = menu->start_x - 1; unsigned int i; if (column + menu->max_entry_len + 5 > (gsize) menubar->widget.cols) column = menubar->widget.cols - menu->max_entry_len - 5; tty_setcolor (MENU_ENTRY_COLOR); draw_box (menubar->widget.owner, menubar->widget.y + 1, menubar->widget.x + column, count + 2, menu->max_entry_len + 5, FALSE); for (i = 0; i < count; i++) menubar_paint_idx (menubar, i, i == menu->selected ? MENU_SELECTED_COLOR : MENU_ENTRY_COLOR); }
/* Returns the width of the thumbnail */ static int draw_level(SDL_Surface *surface, struct LevelThumbnail *level, int x,int y,int visibility,int selected) { int thwidth; SDL_Rect rect; Uint8 alpha; rect.x = x; rect.y = y; if(level->thumbnail) { SDL_Rect src = {0,0,level->thumbnail->w,level->thumbnail->h}; thwidth = level->thumbnail->w; if(rect.x<0) { src.x = -rect.x; src.w -= src.x; rect.x = 0; } if(visibility > level->thumbnail->w) alpha = SDL_ALPHA_OPAQUE; else alpha = visibility/(double)level->thumbnail->w*SDL_ALPHA_OPAQUE; SDL_SetAlpha(level->thumbnail,SDL_SRCALPHA,alpha); SDL_BlitSurface(level->thumbnail,&src,surface,&rect); } else { rect.w = THUMBNAIL_HEIGHT; rect.h = THUMBNAIL_HEIGHT; thwidth = rect.w; if(visibility > THUMBNAIL_HEIGHT) alpha = SDL_ALPHA_OPAQUE; else alpha = visibility/(double)THUMBNAIL_HEIGHT*SDL_ALPHA_OPAQUE; fill_box(surface,rect.x,rect.y,rect.w,rect.h,map_rgba(0,0,0,alpha)); } if(selected) { draw_box(rect.x-3, rect.y-3, rect.w+6, rect.h+6, 3, col_cyan); rect.y += rect.h + 4; rect.x += rect.w/2 - level->name->w/2; SDL_BlitSurface(level->name,NULL,surface,&rect); } return thwidth; }
void kmain( void* mbd, unsigned int magic ) { if ( magic != 0x2BADB002 ) { /* Something went not according to specs. Print an error */ /* message and halt, but do *not* rely on the multiboot */ /* data structure. */ kputs("magic number failed, a-bloo a-bloo :("); return; } /* You could either use multiboot.h */ /* (http://www.gnu.org/software/grub/manual/multiboot/multiboot.html#multiboot_002eh) */ /* or do your offsets yourself. The following is merely an example. */ char * boot_loader_name =(char*) ((long*)mbd)[16]; clear(); kputs("Welcome to BonzOS"); kputs("~ My OS is a POS ~"); kputs(boot_loader_name); kputs(""); kputs("Testing memcpy, memset, and memcmp:"); test_memcpy(); test_memset(); test_memcmp(); if (bochs_vga_available()) { kputs("Bochs VGA is available."); bochs_vga_set_resolution(800, 600); clear_screen(0xFF); clear_screen(0xEE); clear_screen(0x77); clear_screen(0x0); draw_box(30, 30, 100, 100, 0x00FFFF00); } }
int main( int argc, char* argv[] ) { box = cvRect(-1,-1,0,0); IplImage* image = cvLoadImage(argv[1]); //cvZero( image ); IplImage* temp = cvCloneImage( image ); cvNamedWindow( "Box Example" ); // Here is the crucial moment that we actually install // the callback. Note that we set the value ‘param’ to // be the image we are working with so that the callback // will have the image to edit. // cvSetMouseCallback( "Box Example", my_mouse_callback, (void*) image ); // The main program loop. Here we copy the working image // to the ‘temp’ image, and if the user is drawing, then // put the currently contemplated box onto that temp image. // display the temp image, and wait 15ms for a keystroke, // then repeat... // while( 1 ) { cvCopyImage( image, temp ); if( drawing_box ) draw_box( temp, box ); if(count==2) { cvSetImageROI(temp,box); cvShowImage("Cropped",temp); cvSaveImage(argv[1],temp); break; } cvShowImage( "Box Example", temp ); if( cvWaitKey( 15 )==27 ) break; } // Be tidy // cvReleaseImage( &image ); cvReleaseImage( &temp ); cvDestroyWindow( "Box Example" ); }
static cb_ret_t panelize_callback (Dlg_head *h, dlg_msg_t msg, int parm) { switch (msg) { case DLG_DRAW: common_dialog_repaint (h); attrset (COLOR_NORMAL); draw_box (h, UY, UX, h->lines - 10, h->cols - 10); return MSG_HANDLED; case DLG_POST_KEY: /* fall */ case DLG_INIT: attrset (MENU_ENTRY_COLOR); update_command (); return MSG_HANDLED; default: return default_dlg_callback (h, msg, parm); } }
static cb_ret_t panelize_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, void *data) { switch (msg) { case DLG_INIT: case DLG_POST_KEY: tty_setcolor (MENU_ENTRY_COLOR); update_command (); return MSG_HANDLED; case DLG_DRAW: common_dialog_repaint (h); tty_setcolor (COLOR_NORMAL); draw_box (h, UY, UX, h->lines - 10, h->cols - 10, TRUE); return MSG_HANDLED; default: return default_dlg_callback (h, sender, msg, parm, data); } }
/** Clean the dialog area, draw the frame and the title */ void common_dialog_repaint (Dlg_head * h) { int space; if (h->state != DLG_ACTIVE) return; space = (h->flags & DLG_COMPACT) ? 0 : 1; tty_setcolor (h->color[DLG_COLOR_NORMAL]); dlg_erase (h); draw_box (h, space, space, h->lines - 2 * space, h->cols - 2 * space, FALSE); if (h->title != NULL) { tty_setcolor (h->color[DLG_COLOR_TITLE]); dlg_move (h, space, (h->cols - str_term_width1 (h->title)) / 2); tty_print_string (h->title); } }
/* void draw_box (ESContext *esContext, int16_t x, int16_t y, int16_t w, int16_t h, uint8_t r, uint8_t g, uint8_t b, uint8_t a) { */ int tclcmd_draw_box (ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { if (objc != 9) { Tcl_WrongNumArgs (interp, 1, objv, "{ESContext *esContext} { int16_t x} { int16_t y} { int16_t w} { int16_t h} { uint8_t r} { uint8_t g} { uint8_t b} { uint8_t a}"); return TCL_ERROR; } int16_t arg_x; if (Tcl_GetIntFromObj(interp, objv[1], (int *)&arg_x) != TCL_OK) { return TCL_ERROR; } int16_t arg_y; if (Tcl_GetIntFromObj(interp, objv[2], (int *)&arg_y) != TCL_OK) { return TCL_ERROR; } int16_t arg_w; if (Tcl_GetIntFromObj(interp, objv[3], (int *)&arg_w) != TCL_OK) { return TCL_ERROR; } int16_t arg_h; if (Tcl_GetIntFromObj(interp, objv[4], (int *)&arg_h) != TCL_OK) { return TCL_ERROR; } uint8_t arg_r; if (Tcl_GetIntFromObj(interp, objv[5], (int *)&arg_r) != TCL_OK) { return TCL_ERROR; } uint8_t arg_g; if (Tcl_GetIntFromObj(interp, objv[6], (int *)&arg_g) != TCL_OK) { return TCL_ERROR; } uint8_t arg_b; if (Tcl_GetIntFromObj(interp, objv[7], (int *)&arg_b) != TCL_OK) { return TCL_ERROR; } uint8_t arg_a; if (Tcl_GetIntFromObj(interp, objv[8], (int *)&arg_a) != TCL_OK) { return TCL_ERROR; } draw_box(GlobalesContext, arg_x, arg_y, arg_w, arg_h, arg_r, arg_g, arg_b, arg_a); return TCL_OK; }
/* Draw a column of numbers at the left of the current point */ static void draw_numbers(FILE *out, unsigned int maxnum, bool move_down) { unsigned int i; /* Draw title */ fprintf(out, "-%u 0 rmoveto\n", NORMAL_COLUMN_WIDTH); draw_box(out, NORMAL_COLUMN_WIDTH, TOP_BOX_HEIGHT, "Count", NUMBER_FONT_SIZE, ORIENT_VERTICAL, true); fprintf(out, "-%u -%u rmoveto\n", NORMAL_COLUMN_WIDTH, TOP_BOX_HEIGHT); /* Set font */ fprintf(out, "/%s findfont ", COUNT_NUMBER_FONT); fprintf(out, "%u scalefont setfont ", NUMBER_FONT_SIZE); if (move_down) { fprintf(out, "0 -%u rmoveto\n", NORMAL_COLUMN_HEIGHT/2); /* Draw lines to attach up */ fprintf(out, "gsave" " 0 %u rlineto %u 0 rmoveto 0 -%u rlineto stroke" " grestore\n", NORMAL_COLUMN_HEIGHT/2, NORMAL_COLUMN_WIDTH, NORMAL_COLUMN_HEIGHT/2); } /* Draw every digit H. */ for (i = 0; i < maxnum; i++) { char countstr[INT_CHARS+1]; sprintf(countstr, "%u", i+1); /* Set width */ fprintf(out, "%u\n", NORMAL_COLUMN_WIDTH); draw_pair(out, countstr, "", NUMBER_FONT_SIZE, true); } /* Move back up to the top. */ fprintf(out, "0 %u rmoveto\n", NORMAL_COLUMN_HEIGHT*maxnum + TOP_BOX_HEIGHT + NORMAL_COLUMN_HEIGHT/2); }
void pager_draw_button (int x, int num) { char label; #ifdef XFT XftColor col; #endif if (num == tb.my_desktop) { /* current desktop */ draw_box (x, PAGER_BUTTON_WIDTH); } else { set_foreground (5); fill_rect (x, 1, PAGER_BUTTON_WIDTH+1, WINHEIGHT - 2); } label = '1' + num; #ifdef XFT col.color.alpha = 0xffff; col.color.red = cols[5].red; col.color.green = cols[5].green; col.color.blue = cols[5].blue; XftDrawString8 (xftdraw, &col, xfs, x + ((PAGER_BUTTON_WIDTH - PAGER_DIGIT_WIDTH) / 2), text_y, &label, 1); #else if (num == tb.my_desktop) { set_foreground (6); } else { set_foreground (4); } XDrawString (dd, tb.win, fore_gc, x + ((PAGER_BUTTON_WIDTH - PAGER_DIGIT_WIDTH) / 2) - 1, text_y, &label, 1); #endif }
void RecordMonitorGUI:: display_video_text(int x, int y, const char *text, int font, int bg_color, int color, int alpha, double secs, double scale) { lock_window("RecordMonitorGUI::display_text"); set_font(font); int ch = get_text_height(font); int h = get_text_height(font,text) + ch/2; int w = get_text_width(font, text) + ch; BC_Pixmap pixmap(this, w, h); set_opaque(); set_color(bg_color); draw_box(0, 0, w, h, &pixmap); set_color(color); draw_text(ch/2, ch, text, strlen(text), &pixmap); BC_Bitmap bitmap(this, w, h, BC_RGB888, 0); VFrame in(&bitmap, w, h, BC_RGB888, -1); Drawable drawable = pixmap.get_pixmap(); bitmap.read_drawable(drawable, 0, 0, &in); unlock_window(); record->display_vframe(&in, x, y, alpha, secs, scale); }
void report_transfer(unsigned int count, struct fraction value, unsigned int votes_transferred) { char valstring[INT_CHARS + sizeof(" / ") + INT_CHARS]; /* If denominator == 1, skip it */ if (value.denominator == 1) sprintf(valstring, "%lu", value.numerator); else sprintf(valstring, "%lu / %lu", value.numerator, value.denominator); fprintf(counting.out, "%u -%u moveto\n", counting.transfer_value, TOP_BOX_HEIGHT + (count-1)*NORMAL_COLUMN_HEIGHT); draw_box(counting.out, FRACTION_COLUMN_WIDTH, NORMAL_COLUMN_HEIGHT, valstring, NUMBER_FONT_SIZE, ORIENT_HORIZONTAL, true); draw_number_box(counting.out, count-1, counting.to_table2, votes_transferred); }
static cb_ret_t groupbox_callback (Widget * w, widget_msg_t msg, int parm) { WGroupbox *g = (WGroupbox *) w; switch (msg) { case WIDGET_INIT: return MSG_HANDLED; case WIDGET_FOCUS: return MSG_NOT_HANDLED; case WIDGET_DRAW: { gboolean disabled = (w->options & W_DISABLED) != 0; tty_setcolor (disabled ? DISABLED_COLOR : COLOR_NORMAL); draw_box (g->widget.owner, g->widget.y - g->widget.owner->y, g->widget.x - g->widget.owner->x, g->widget.lines, g->widget.cols, TRUE); if (g->title != NULL) { tty_setcolor (disabled ? DISABLED_COLOR : COLOR_TITLE); dlg_move (g->widget.owner, g->widget.y - g->widget.owner->y, g->widget.x - g->widget.owner->x + 1); tty_print_string (g->title); } return MSG_HANDLED; } case WIDGET_DESTROY: g_free (g->title); return MSG_HANDLED; default: return default_proc (msg, parm); } }
Var* ff_drawshape(vfuncptr func, Var* arg) { Var *obj = NULL, *ovar = NULL; size_t x, y, z; char* out; float ignore = FLT_MAX; const char* options[] = {"cross", "box", "circle", NULL}; const char* shape = options[0]; Alist alist[9]; alist[0] = make_alist("object", ID_VAL, NULL, &obj); alist[1] = make_alist("shape", ID_ENUM, options, &shape); alist[2] = make_alist("ignore", DV_FLOAT, NULL, &ignore); alist[3].name = NULL; if (parse_args(func, arg, alist) == 0) return (NULL); if (obj == NULL) { parse_error("%s: No object specified\n", func->name); return (NULL); } x = GetX(obj); y = GetY(obj); z = GetZ(obj); out = calloc(x * y, sizeof(char)); ovar = newVal(BSQ, x, y, 1, DV_UINT8, out); if (!strcmp(shape, "cross")) { draw_cross(obj, x, y, ignore, out); } else if (!strcmp(shape, "box")) { draw_box(obj, x, y, ignore, out); } else if (!strcmp(shape, "circle")) { draw_circle(obj, x, y, ignore, out); } return (ovar); }
void TaskButton::draw(void) { Fl_Color col = value() ? selection_color() : color(); draw_box(value() ? (down_box() ? down_box() : fl_down(box())) : box(), col); if(image()) { int X, Y, lw, lh; X = x() + 5; Y = (y() + h() / 2) - (image()->h() / 2); image()->draw(X, Y); X += image()->w() + 5; if(label()) { fl_font(labelfont(), labelsize()); fl_color(labelcolor()); lw = lh = 0; fl_measure(label(), lw, lh, 0); /* use clipping so long labels do not be drawn on the right border, which looks ugly */ fl_push_clip(x() + Fl::box_dx(box()), y() + Fl::box_dy(box()), w() - Fl::box_dw(box()) - 5, h() - Fl::box_dh(box())); Y = (y() + h() / 2) - (lh / 2); fl_draw(label(), X, Y, lw, lh, align(), 0, 0); fl_pop_clip(); } } else { draw_label(); } if(Fl::focus() == this) draw_focus(); }
/* Displays a dialog box */ static widget_handler_status_T display_listbox(struct dialog_data *dlg_data, struct widget_data *widget_data) { struct terminal *term = dlg_data->win->term; struct listbox_data *box = get_listbox_widget_data(widget_data); struct listbox_context data; listbox_sel_move(widget_data, 0); draw_box(term, &widget_data->box, ' ', 0, get_bfu_color(term, (const unsigned char *)"menu.normal")); memset(&data, 0, sizeof(data)); data.term = term; data.widget_data = widget_data; data.box = box; data.dlg_data = dlg_data; traverse_listbox_items_list(box->top, box, widget_data->box.height, 1, display_listbox_item, &data); return EVENT_PROCESSED; }
int set_avg_pos( IplImage* frame){ CvScalar avgScalar; CvScalar stnScalar; cvSetImageROI(frame,g_msPrm.box); cvAvgSdv(frame,&avgScalar,&stnScalar,NULL); set_sliders_filter("set_HSV",&avgScalar,&stnScalar); printf("avg h - %f s - %f v - %f\n", avgScalar.val[0], avgScalar.val[1], avgScalar.val[2] ); printf("avg hs - %f ss - %f vs - %f\n", stnScalar.val[0], stnScalar.val[1], stnScalar.val[2] ); cvResetImageROI(frame); //cvCvtColor(frame,frame,CV_HSV2RGB); draw_box(frame,g_msPrm.box); cvShowImage("Camera",frame); return 0; }
EDELIB_NS_BEGIN void MenuBar::draw() { draw_box(); if (!menu() || !menu()->text) return; const MenuItem* m; int X = x()+6; for (m=menu()->first(); m->text; m = m->next()) { int W = m->measure(0,this) + 16; m->draw(X, y(), W, h(), this); X += W; if (m->flags & FL_MENU_DIVIDER) { int y1 = y() + Fl::box_dy(box()); int y2 = y1 + h() - Fl::box_dh(box()) - 1; // Draw a vertical divider between menus... fl_color(FL_DARK3); fl_yxline(X - 6, y1, y2); fl_color(FL_LIGHT3); fl_yxline(X - 5, y1, y2); } } }
static void do_render(void) { clear_canvas(impl.cvs, 0x0); clear_canvas(impl.pnl, 0x0); draw_bm(impl.cvs, impl.bm, 0, 0, BOX_SZ, 0x7f7f7f7f, 0xff); draw_sb(impl.cvs, impl.sb, 0, 0, BOX_SZ, 0xff7f7f7f, 0xe0); draw_grid(impl.cvs, impl.bm, 0, 0, BOX_SZ, 0x10ffffff); draw_box(impl.pnl, 0, 0, 100, 100, 0x0, 0xff111111); draw_shape_center(impl.pnl, 0, 20, 50, 50, 12, impl.queue->queue[0], 0x3f<<24, 0xf0); draw_shape_center(impl.pnl, 55, 20, 40, 40, 10, impl.queue->queue[1], 0x2f<<24, 0xc0); draw_shape_center(impl.pnl, 55, 60, 40, 40, 10, impl.queue->queue[2], 0x1f<<24, 0x80); draw_shape_center(impl.pnl, 55, 100, 40, 40, 10, impl.queue->queue[3], 0x0f<<24, 0x50); blit_ui(impl.cvs, 0, 0); blit_ui(impl.pnl, BOX_SZ*XRES, 0); }
static void onMouseRect( int event, int x, int y, int, void* ) { switch( event ){ case CV_EVENT_MOUSEMOVE: if( drawing_box ){ box.width = x-box.x; box.height = y-box.y; } break; case CV_EVENT_LBUTTONDOWN: drawing_box = true; box = cvRect( x, y, 0, 0 ); break; case CV_EVENT_LBUTTONUP: drawing_box = false; if( box.width < 0 ){ box.x += box.width; box.width *= -1; } if( box.height < 0 ){ box.y += box.height; box.height *= -1; } box.x+=1; box.y+=1; box.width-=1; box.height-=1; draw_box( imageR, box ); flag=1; break; } }
// This is our mouse callback. If the user // presses the left button, we start a box. // when the user releases that button, then we // add the box to the current image. When the // mouse is dragged (with the button down) we // resize the box. // void my_mouse_callback( int event, int x, int y, int flags, void* param ) { IplImage* image = (IplImage*) param; switch( event ) { case CV_EVENT_MOUSEMOVE: { if( drawing_box ) { box.width = x-box.x; box.height = y-box.y; } } break; case CV_EVENT_LBUTTONDOWN: { drawing_box = true; if(count==0) count++; box = cvRect(x, y, 0, 0); } break; case CV_EVENT_LBUTTONUP: { drawing_box = false; if(box.width<0) { box.x+=box.width; box.width *=-1; } if(box.height<0) { box.y+=box.height; box.height*=-1; } if(count==1) count++; draw_box(image, box); } break; } }
static void draw_onoff(Layer *layer, GContext *ctx) { GColor border_color; GColor fill_color; #ifdef PBL_COLOR switch (s_onoff_mode) { case MODE_OFF: border_color = GColorRed; fill_color = GColorMelon; break; case MODE_ON: border_color = GColorJaegerGreen; fill_color = GColorMintGreen; break; case MODE_ACTIVE: border_color = GColorChromeYellow; fill_color = GColorPastelYellow; break; } #else border_color = GColorWhite; fill_color = GColorBlack; #endif draw_box(layer, ctx, border_color, fill_color, COLOR_FALLBACK(GColorBlack, GColorWhite), s_onoff_text); }
CvRect Kalman_Filter::get_roi_from_user(IplImage *img) { IplImage* temp = cvCloneImage( img ); cvNamedWindow( "Box Example" ); // Here is the crucial moment that we actually install // the callback. Note that we set the value ‘param’ to // be the image we are working with so that the callback // will have the image to edit. // cvSetMouseCallback( "Box Example", Kalman_Filter::my_mouse_callback, (void*) img ); // The main program loop. Here we copy the working image // to the ‘temp’ image, and if the user is drawing, then // put the currently contemplated box onto that temp image. // display the temp image, and wait 15ms for a keystroke, // then repeat... // while( 1 ) { //cvCopyImage( img, temp ); cvCopy( img, temp ); if( s_bDrawing_box ) draw_box( temp, s_box ); cvShowImage( "Box Example", temp ); if( cvWaitKey( 15 )==13 ) break; } // Be tidy // cvReleaseImage( &temp ); cvDestroyWindow( "Box Example" ); return s_box; }
static void tree_frame (Dlg_head * h, WTree * tree) { tty_setcolor (NORMAL_COLOR); widget_erase ((Widget *) tree); if (tree->is_panel) { const char *title = _("Directory tree"); const int len = str_term_width1 (title); draw_box (h, tree->widget.y, tree->widget.x, tree->widget.lines, tree->widget.cols, FALSE); widget_move (&tree->widget, 0, (tree->widget.cols - len - 2) / 2); tty_printf (" %s ", title); if (panels_options.show_mini_info) widget_move (&tree->widget, tlines (tree) + 1, 0); tty_print_alt_char (ACS_LTEE, FALSE); widget_move (&tree->widget, tlines (tree) + 1, tree->widget.cols - 1); tty_print_alt_char (ACS_RTEE, FALSE); tty_draw_hline (tree->widget.y + tlines (tree) + 1, tree->widget.x + 1, ACS_HLINE, tree->widget.cols - 2); } }
int main() { box = cvRect(-1,-1,0,0); char name[100]; IplImage *tmp=cvLoadImage("kolkata.jpg"); tada=set_cop(cvCloneImage(tmp)); //sprintf(abc,"file%d",k++); //cvSaveImage(abc,tada); struct wateripl *wat=(struct wateripl *)malloc(sizeof(struct wateripl *)); wat->img=tmp; wat->water=tada; IplImage *temp=(cvCloneImage(wat->img)); cvNamedWindow("box example",CV_WINDOW_AUTOSIZE); cvNamedWindow("zoom output",CV_WINDOW_AUTOSIZE); cvSetMouseCallback("box example",my_mouse_callback,(void *)wat); while(1) { cvCopyImage(wat->water,temp); if( drawing_box ) draw_box( temp,box ); cvShowImage("box example",temp); //changed cvShowImage("zoom output",tada); if(cvWaitKey(15) == 27 ) break; } //cvReleaseImage(&image); cvReleaseImage(&temp); cvDestroyWindow("box example"); return 0; }
/** * \brief Render the bounding box of the items. * \param e (out) The scene elements. * \param delta The delta to apply to the position of the items. */ void bear::wireframe_layer::render ( scene_element_list& e, const visual::position_type& delta ) const { item_list::const_iterator it; visual::color_type color; color.components.alpha = 255; for (it=m_items.begin(); it!=m_items.end(); ++it) { if ( *it != NULL ) { uintptr_t addr = reinterpret_cast<uintptr_t>(*it); color.components.red = (~addr & 0xFF); color.components.green = (~addr & 0xFF00) >> 8; color.components.blue = (~addr & 0xFF0000) >> 16; draw_box(e, delta, **it, color); draw_internal_forces( e, delta, **it, color ); draw_system(e, delta, **it, color); draw_slope(e, delta, **it, color); } }
void Fl_Spin::draw() { int sxx = x(), syy = y(), sww = w(), shh = h(); Fl_Boxtype box1 = (Fl_Boxtype)(box()); int border_size=Fl::box_dx(box()); if (damage()&~FL_DAMAGE_CHILD) clear_damage(FL_DAMAGE_ALL); if (!box1) box1 = (Fl_Boxtype)(box()&-2); if((indrag || mouseobj) && deltadir!=0) { if(deltadir>0) { draw_box(down(box1),sxx,syy,sww,shh/2,color()); draw_box(box1,sxx,syy+shh/2,sww,shh/2,color()); } else { draw_box(box1,sxx,syy,sww,shh/2,color()); draw_box(down(box1),sxx,syy+shh/2,sww,shh/2,color()); } } else { draw_box(box1,sxx,syy,sww,shh/2,color()); draw_box(box1,sxx,syy+shh/2,sww,shh/2,color()); } sxx+=border_size; syy+=border_size; sww-=border_size*2; shh-=border_size*2; if (active_r()) { fl_color(selection_color()); } else { fl_color(selection_color() | 8); } int w1 = (sww-1)|1; // use odd sizes only int X = sxx+w1/2; int W = w1/3; int h1 = shh/2-border_size-2; int Y= syy; fl_polygon(X, Y, X+W,Y+h1 , X-W, Y+h1); Y=syy+shh/2+border_size+1+h1; fl_polygon(X, Y, X-W, Y-h1, X+W, Y-h1); clear_damage(); }
static int do_test(float x, int all_at_once) { static const struct { float x; float y; float z; float w; float h; int expected; GLubyte color[3]; } tests[MAX_QUERIES] = { { 25.0f, 25.0f, 0.2f, 20.0f, 20.0f, 20 * 20, { 0x00, 0xff, 0x00 } }, { 45.0f, 45.0f, -0.2f, 20.0f, 20.0f, 0, { 0x00, 0x7f, 0xf0 } }, { 10.0f, 10.0f, -0.3f, 75.0f, 75.0f, (75 * 75) - (55 * 55), { 0x00, 0x00, 0xff } }, { 20.0f, 20.0f, -0.1f, 55.0f, 55.0f, 0, { 0x7f, 0x7f, 0x00 } }, { 50.0f, 25.0f, 0.2f, 20.0f, 20.0f, 20 * 20, { 0x00, 0x7f, 0xf0 } }, }; GLint passed; int test_pass = 1; unsigned i; /* Draw an initial red box that is 2500 pixels. All of the occlusion * query measurements are relative to this box. */ glColor3ub(0xff, 0x00, 0x00); draw_box(x + 20.0f, 20.0f, 0.0f, 55.0f, 55.0f); for (i = 0; i < MAX_QUERIES; i++) { (*begin_query)(GL_SAMPLES_PASSED, occ_queries[i]); glColor3ubv(tests[i].color); draw_box(x + tests[i].x, tests[i].y, tests[i].z, tests[i].w, tests[i].h); (*end_query)(GL_SAMPLES_PASSED); if (! all_at_once) { (*get_query_objectiv)(occ_queries[i], GL_QUERY_RESULT, &passed); test_pass &= check_result(passed, tests[i].expected); } } if (all_at_once) { for (i = 0; i < MAX_QUERIES; i++) { (*get_query_objectiv)(occ_queries[i], GL_QUERY_RESULT, &passed); test_pass &= check_result(passed, tests[i].expected); } } printf("\n"); return test_pass; }
int title_screen(const char *commands[100], int *f, double noteinfo[2][1000], char output[1000]){ int xsize=1250; int ysize=1000; int xpos; int ypos; int height=400; int width=(xsize-50)/16; int i,j; char input[20]; char initial[1000]; char c; gfx_open(xsize, ysize, "Digital Piano"); quit_button(); draw_title(100); draw_name(50); draw_name2(50); draw_button(295,600,70,310); draw_button(645,600,70,310); button_label(60); button_label2(60); while (1){ c=gfx_wait(); xpos=gfx_xpos(); ypos=gfx_ypos(); //user clicks the quit button if (xpos>=1110 && xpos<=1210 && ypos>=850 && ypos<=890){ return 0; } //user clicks free play button if (xpos>=295 && xpos<=605 && ypos>=600 && ypos<=670){ gfx_clear(); piano_graphic(commands, f); } //user clicks load file button if (xpos>=645 && xpos<=955 && ypos>=600 && ypos<=670){ terminal_message(); printf("Please enter the name of the file, including the extension.\nThe file content should follow the same format as the examples in lab 8:\n"); scanf("%s", input); //scans file name into input FILE *music=fopen(input, "r"); if ((music=fopen(input, "r")) == NULL){ //returns error if file not found puts("File could not be opened"); return 0; } else{ //scans the file into output for (j=0; j<1000; j++){ fscanf(music, "%c", &output[j]); if (output[j]=='X'){ break; } } } piano2(noteinfo, output); //fork to play sound while lighting up keys if (fork()){ system("play sound.wav"); } else{ gfx_clear(); draw_piano(width, height); draw_arrow(50, f); gfx_color(255,255,255); draw_box(); octave_label(30); quit_button(); gfx_flush(); key_animation(noteinfo, f); return 0; } } } }
static void draw_baddie_internal(const az_baddie_t *baddie, az_clock_t clock) { const float flare = baddie->armor_flare; const float frozen = (baddie->frozen <= 0.0 ? 0.0 : baddie->frozen >= 0.2 ? 0.5 + 0.5 * baddie->frozen : az_clock_mod(3, 2, clock) < 2 ? 0.6 : 0.0); if (baddie->frozen > 0.0) clock = 0; switch (baddie->kind) { case AZ_BAD_NOTHING: AZ_ASSERT_UNREACHABLE(); case AZ_BAD_MARKER: glColor3f(1, 0, 1); // magenta glBegin(GL_LINE_STRIP); { glVertex2f(-20, 0); glVertex2f(20, 0); glVertex2f(0, 20); glVertex2f(0, -20); glVertex2f(20, 0); } glEnd(); break; case AZ_BAD_NORMAL_TURRET: az_draw_bad_normal_turret(baddie, frozen, clock); break; case AZ_BAD_ZIPPER: az_draw_bad_zipper(baddie, frozen, clock); break; case AZ_BAD_BOUNCER: az_draw_bad_bouncer(baddie, frozen, clock); break; case AZ_BAD_ATOM: az_draw_bad_atom(baddie, frozen, clock); break; case AZ_BAD_SPINER: az_draw_bad_spiner(baddie, frozen, clock); break; case AZ_BAD_BOX: assert(frozen == 0.0); draw_box(baddie, false, flare); break; case AZ_BAD_ARMORED_BOX: assert(frozen == 0.0); draw_box(baddie, true, flare); break; case AZ_BAD_CLAM: az_draw_bad_clam(baddie, frozen, clock); break; case AZ_BAD_NIGHTBUG: az_draw_bad_nightbug(baddie, frozen, clock); break; case AZ_BAD_SPINE_MINE: az_draw_bad_spine_mine(baddie, frozen, clock); break; case AZ_BAD_BROKEN_TURRET: az_draw_bad_broken_turret(baddie, frozen, clock); break; case AZ_BAD_ZENITH_CORE: az_draw_bad_zenith_core(baddie, clock); break; case AZ_BAD_ARMORED_TURRET: az_draw_bad_armored_turret(baddie, frozen, clock); break; case AZ_BAD_DRAGONFLY: az_draw_bad_dragonfly(baddie, frozen, clock); break; case AZ_BAD_CAVE_CRAWLER: az_draw_bad_cave_crawler(baddie, frozen, clock); break; case AZ_BAD_CRAWLING_TURRET: az_draw_bad_crawling_turret(baddie, frozen, clock); break; case AZ_BAD_HORNET: az_draw_bad_hornet(baddie, frozen, clock); break; case AZ_BAD_BEAM_SENSOR: az_draw_bad_beam_sensor(baddie, frozen, clock); break; case AZ_BAD_BEAM_SENSOR_INV: az_draw_bad_beam_sensor_inv(baddie, frozen, clock); break; case AZ_BAD_ROCKWYRM: az_draw_bad_rockwyrm(baddie); break; case AZ_BAD_WYRM_EGG: az_draw_bad_wyrm_egg(baddie, frozen, clock); break; case AZ_BAD_WYRMLING: az_draw_bad_wyrmling(baddie, frozen); break; case AZ_BAD_TRAPDOOR: glBegin(GL_TRIANGLE_FAN); { glColor3f(0.8f - 0.8f * frozen, 0.5, 0.5f + 0.5f * frozen); glVertex2f(0, 0); glColor3f(0.4f - 0.4f * frozen, 0.2, 0.2f + 0.3f * frozen); const az_polygon_t polygon = baddie->data->main_body.polygon; for (int i = polygon.num_vertices - 1, j = 0; i < polygon.num_vertices; i = j++) { glVertex2d(polygon.vertices[i].x, polygon.vertices[i].y); } } glEnd(); glPushMatrix(); { assert(!az_vnonzero(baddie->components[0].position)); glRotated(AZ_RAD2DEG(baddie->components[0].angle), 0, 0, 1); glBegin(GL_POLYGON); { const az_component_data_t *data = &baddie->data->components[0]; glColor3f(0.5f - 0.1f * frozen, 0.5, 0.5f + 0.1f * frozen); for (int i = 0; i < data->polygon.num_vertices; ++i) { if (i == 2) glColor3f(0.4f - 0.1f * frozen, 0.3, 0.3f + 0.1f * frozen); glVertex2d(data->polygon.vertices[i].x, data->polygon.vertices[i].y); } } glEnd(); } glPopMatrix(); break; case AZ_BAD_CAVE_SWOOPER: az_draw_bad_cave_swooper(baddie, frozen, clock); break; case AZ_BAD_ICE_CRAWLER: az_draw_bad_ice_crawler(baddie, frozen, clock); break; case AZ_BAD_BEAM_TURRET: az_draw_bad_beam_turret(baddie, frozen, clock); break; case AZ_BAD_OTH_CRAB_1: case AZ_BAD_OTH_CRAB_2: az_draw_bad_oth_crab(baddie, frozen, clock); break; case AZ_BAD_OTH_ORB_1: case AZ_BAD_OTH_ORB_2: az_draw_bad_oth_orb(baddie, frozen, clock); break; case AZ_BAD_OTH_SNAPDRAGON: az_draw_bad_oth_snapdragon(baddie, frozen, clock); break; case AZ_BAD_OTH_RAZOR_1: az_draw_bad_oth_razor_1(baddie, frozen, clock); break; case AZ_BAD_GUN_SENSOR: az_draw_bad_gun_sensor(baddie, frozen, clock); break; case AZ_BAD_SECURITY_DRONE: az_draw_bad_security_drone(baddie, frozen, clock); break; case AZ_BAD_SMALL_TRUCK: az_draw_bad_small_truck(baddie, frozen, clock); break; case AZ_BAD_HEAT_RAY: az_draw_bad_heat_ray(baddie, frozen, clock); break; case AZ_BAD_NUCLEAR_MINE: draw_mine_arms(18, flare, frozen); // Body: glBegin(GL_POLYGON); { glColor3f(0.65 + 0.3 * flare - 0.3 * frozen, 0.65 - 0.3 * flare, 0.5 - 0.3 * flare + 0.5 * frozen); for (int i = 0; i <= 360; i += 60) { glVertex2d(8 * cos(AZ_DEG2RAD(i)), 8 * sin(AZ_DEG2RAD(i))); } } glEnd(); glBegin(GL_QUAD_STRIP); { for (int i = 0; i <= 360; i += 60) { glColor3f(0.65 + 0.3 * flare - 0.3 * frozen, 0.65 - 0.3 * flare, 0.5 - 0.3 * flare + 0.5 * frozen); glVertex2d(8 * cos(AZ_DEG2RAD(i)), 8 * sin(AZ_DEG2RAD(i))); glColor3f(0.35f + 0.3f * flare, 0.35f, 0.15f + 0.3f * frozen); glVertex2d(12 * cos(AZ_DEG2RAD(i)), 12 * sin(AZ_DEG2RAD(i))); } } glEnd(); // Radiation symbol: if (baddie->state == 1 && az_clock_mod(2, 3, clock)) glColor3f(1, 0, 0); else glColor3f(0, 0, 0.5f * frozen); glBegin(GL_TRIANGLE_FAN); { glVertex2d(0, 0); for (int i = 0; i <= 360; i += 30) { glVertex2d(1.5 * cos(AZ_DEG2RAD(i)), 1.5 * sin(AZ_DEG2RAD(i))); } } glEnd(); for (int j = 60; j < 420; j += 120) { glBegin(GL_QUAD_STRIP); { for (int i = j - 30; i <= j + 30; i += 10) { glVertex2d(3 * cos(AZ_DEG2RAD(i)), 3 * sin(AZ_DEG2RAD(i))); glVertex2d(8 * cos(AZ_DEG2RAD(i)), 8 * sin(AZ_DEG2RAD(i))); } } glEnd(); } break; case AZ_BAD_BEAM_WALL: glBegin(GL_QUADS); { // Interior: glColor3f(0.3, 0.3, 0.3); glVertex2f(50, 15); glVertex2f(-50, 15); glVertex2f(-50, -15); glVertex2f(50, -15); // Diagonal struts: for (int i = 0; i < 3; ++i) { const float x = -50 + 32 * i; for (int j = 0; j < 2; ++j) { const float y = (j ? -12 : 12); glColor3f(0.75 + 0.25 * flare, 0.75, 0.75); glVertex2f(x, y); glVertex2f(x + 32, -y); glColor3f(0.35 + 0.35 * flare, 0.4, 0.35); glVertex2f(x + 32 + 4, -y); glVertex2f(x + 4, y); } } // Top and bottom struts: for (int y = -10; y <= 15; y += 25) { glColor3f(0.75 + 0.25 * flare, 0.75, 0.75); glVertex2f(52, y); glVertex2f(-52, y); glColor3f(0.35 + 0.35 * flare, 0.4, 0.35); glVertex2f(-52, y - 5); glVertex2f(52, y - 5); } } glEnd(); break; case AZ_BAD_SPARK: glBegin(GL_TRIANGLE_FAN); { glColor4f(1, 1, 1, 0.8); glVertex2f(0, 0); glColor4f(0, 1, 0, 0); for (int i = 0; i <= 360; i += 45) { const double radius = (i % 2 ? 1.0 : 0.5) * (8.0 + 0.25 * az_clock_zigzag(8, 3, clock)); const double theta = AZ_DEG2RAD(i + 7 * az_clock_mod(360, 1, clock)); glVertex2d(radius * cos(theta), radius * sin(theta)); } } glEnd(); break; case AZ_BAD_MOSQUITO: az_draw_bad_mosquito(baddie, frozen, clock); break; case AZ_BAD_ARMORED_ZIPPER: az_draw_bad_armored_zipper(baddie, frozen, clock); break; case AZ_BAD_FORCEFIEND: az_draw_bad_forcefiend(baddie); break; case AZ_BAD_CHOMPER_PLANT: az_draw_bad_chomper_plant(baddie, frozen, clock); break; case AZ_BAD_COPTER_HORZ: case AZ_BAD_COPTER_VERT: az_draw_bad_copter(baddie, frozen, clock); break; case AZ_BAD_URCHIN: az_draw_bad_urchin(baddie, frozen, clock); break; case AZ_BAD_BOSS_DOOR: az_draw_bad_boss_door(baddie, frozen, clock); break; case AZ_BAD_ROCKET_TURRET: az_draw_bad_rocket_turret(baddie, frozen, clock); break; case AZ_BAD_MINI_ARMORED_ZIPPER: az_draw_bad_mini_armored_zipper(baddie, frozen, clock); break; case AZ_BAD_SPINED_CRAWLER: az_draw_bad_spined_crawler(baddie, frozen, clock); break; case AZ_BAD_DEATH_RAY: az_draw_bad_death_ray(baddie, frozen, clock); break; case AZ_BAD_OTH_GUNSHIP: az_draw_bad_oth_gunship(baddie, frozen, clock); break; case AZ_BAD_FIREBALL_MINE: glPushMatrix(); { glScalef(1, 1.07, 1); const GLfloat blink = fmax(flare, (baddie->state == 1 && az_clock_mod(2, 4, clock) == 0 ? 0.5 : 0.0)); const double radius = baddie->data->main_body.bounding_radius; glBegin(GL_TRIANGLE_FAN); { glColor3f(0.6f + 0.4f * blink, 0.6f, 0.6f); glVertex2d(-0.15 * radius, 0.2 * radius); glColor3f(0.2f + 0.3f * blink, 0.2f, 0.2f); for (int i = 0; i <= 360; i += 15) { glVertex2d(radius * cos(AZ_DEG2RAD(i)), radius * sin(AZ_DEG2RAD(i))); } } glEnd(); const double hurt = (baddie->data->max_health - baddie->health) / baddie->data->max_health; for (int i = 0; i < 5; ++i) { const double angle = AZ_DEG2RAD(20) + i * AZ_DEG2RAD(72); az_draw_cracks(az_vpolar(-radius, angle), angle, 5 * hurt * (1.5 - 0.33 * ((3 * i) % 5))); } for (int i = 0; i < 10; ++i) { glBegin(GL_TRIANGLE_FAN); { glColor3f(0.4f + 0.3f * blink, 0.4f, 0.4f); glVertex2d(radius - 4, 0); glColor3f(0.2f + 0.3f * blink, 0.2f, 0.2f); glVertex2d(radius - 1, 2); glVertex2d(radius + 6, 0); glVertex2d(radius - 1, -2); } glEnd(); glRotatef(36, 0, 0, 1); } glRotatef(18, 0, 0, 1); for (int i = 0; i < 5; ++i) { glBegin(GL_TRIANGLE_FAN); { glColor3f(0.6f + 0.4f * blink, 0.6f, 0.6f); glVertex2d(radius - 9, 0); glColor3f(0.4f + 0.3f * blink, 0.4f, 0.4f); glVertex2d(radius - 8, 2); glVertex2d(radius - 3, 0); glVertex2d(radius - 8, -2); } glEnd(); glRotatef(72, 0, 0, 1); } } glPopMatrix(); break; case AZ_BAD_LEAPER: { const double tilt_degrees = (baddie->state != 0 ? 0.0 : (1.0 - fmin(baddie->cooldown / 0.5, 1.0)) * 10.0 + az_clock_zigzag(3, 8, clock)); // Legs: for (int flip = 0; flip < 2; ++flip) { glPushMatrix(); { if (flip) glScalef(1, -1, 1); // Upper leg: glPushMatrix(); { glTranslated(-0.5 * tilt_degrees, 0, 0); if (baddie->state == 0) glRotatef(48 - tilt_degrees, 0, 0, 1); else glRotatef(70, 0, 0, 1); glBegin(GL_QUAD_STRIP); { glColor3f(0, 0.2, 0.1); glVertex2d(0, 5); glVertex2d(21, 2); glColor3f(0, 0.3, 0.2); glVertex2d(0, 0); glVertex2d(23, 0); glColor3f(0, 0.2, 0.1); glVertex2d(0, -4); glVertex2d(21, -3); } glEnd(); } glPopMatrix(); // Lower leg: if (baddie->state == 0) { glTranslated(-20, 20 + az_clock_zigzag(3, 8, clock), 0); glRotated(-tilt_degrees, 0, 0, 1); } else { glTranslated(-30, 18, 0); glRotated(5, 0, 0, 1); } glBegin(GL_QUAD_STRIP); { glColor3f(0, 0.25, 0.1); glVertex2d(2, 5); glColor3f(0.25, 0.15, 0); glVertex2d(35, 4); glColor3f(0.5f * flare, 0.6, 0.4f + 0.6f * frozen); glVertex2d(0, 0); glColor3f(0.3f + 0.3f * flare, 0.2, frozen); glVertex2d(35, 0); glColor3f(0, 0.25, 0.1); glVertex2d(2, -6); glColor3f(0.25, 0.15, 0); glVertex2d(35, -4); } glEnd(); glBegin(GL_QUAD_STRIP); { glColor3f(0, 0.25, 0.1); glVertex2d(18, 6); glVertex2d(35, 4); glColor3f(0.5f * flare, 0.6f + 0.4f * flare, 0.4f + 0.6f * frozen); glVertex2d(16, 0); glVertex2d(35, 0); glColor3f(0, 0.25, 0.1); glVertex2d(18, -6); glVertex2d(35, -4); } glEnd(); // Foot: glBegin(GL_TRIANGLE_FAN); { glColor3f(0.5, 0.5, 0.5); glVertex2d(0, -1); glColor3f(0.2, 0.3, 0.3); for (int i = -105; i <= 105; i += 30) { glVertex2d(5 * cos(AZ_DEG2RAD(i)), 7 * sin(AZ_DEG2RAD(i)) - 1); } } glEnd(); // Knee knob: glTranslatef(35, 0, 0); glBegin(GL_TRIANGLE_FAN); { glColor3f(0.5f * flare, 0.6, 0.4 + 0.6f * frozen); glVertex2d(0, 0); glColor3f(0, 0.25, 0.1); for (int i = -135; i <= 135; i += 30) { glVertex2d(6 * cos(AZ_DEG2RAD(i)), 5 * sin(AZ_DEG2RAD(i))); } } glEnd(); // Knee spike: glBegin(GL_TRIANGLE_FAN); { glColor3f(0.5, 0.5, 0.5); glVertex2f(4, 0); glColor3f(0.25, 0.25, 0.25); glVertex2f(5, 2); glVertex2f(10, 0); glVertex2f(5, -2); } glEnd(); } glPopMatrix(); } glPushMatrix(); { glTranslated(-0.5 * tilt_degrees, 0, 0); // Teeth: const int x = (baddie->state == 0 ? 0 : 3); for (int y = -2; y <= 2; y += 4) { glBegin(GL_TRIANGLE_FAN); { glColor3f(0.5, 0.5, 0.5); glVertex2i(8 + x, y); glColor3f(0.25, 0.25, 0.25); glVertex2i(9 + x, 2 + y); glVertex2i(15 + x, y); glVertex2i(9 + x, -2 + y); } glEnd(); } // Body: glBegin(GL_TRIANGLE_FAN); { glColor3f(flare, 0.9, 0.5f + 0.5f * frozen); glVertex2d(-3, 0); glColor3f(0.5f * flare, 0.25, 0.1f + 0.9f * frozen); glVertex2d(-10, 0); for (int i = -135; i <= 135; i += 30) { glVertex2d(12 * cos(AZ_DEG2RAD(i)), 9 * sin(AZ_DEG2RAD(i))); } glVertex2d(-10, 0); } glEnd(); // Eye: glBegin(GL_POLYGON); { glColor4f(1, 0, 0, 0.4); glVertex2f(10, 1); glVertex2f(9, 2); glVertex2f(7, 0); glVertex2f(9, -2), glVertex2f(10, -1); } glEnd(); } glPopMatrix(); } break; case AZ_BAD_BOUNCER_90: az_draw_bad_bouncer_90(baddie, frozen, clock); break; case AZ_BAD_PISTON: az_draw_bad_piston(baddie, frozen, clock); break; case AZ_BAD_ARMORED_PISTON: case AZ_BAD_ARMORED_PISTON_EXT: az_draw_bad_armored_piston(baddie, frozen, clock); break; case AZ_BAD_INCORPOREAL_PISTON: case AZ_BAD_INCORPOREAL_PISTON_EXT: az_draw_bad_incorporeal_piston(baddie, frozen, clock); break; case AZ_BAD_CRAWLING_MORTAR: az_draw_bad_crawling_mortar(baddie, frozen, clock); break; case AZ_BAD_FIRE_ZIPPER: az_draw_bad_fire_zipper(baddie, frozen, clock); break; case AZ_BAD_SUPER_SPINER: az_draw_bad_super_spiner(baddie, frozen, clock); break; case AZ_BAD_HEAVY_TURRET: az_draw_bad_heavy_turret(baddie, frozen, clock); break; case AZ_BAD_ECHO_SWOOPER: az_draw_bad_echo_swooper(baddie, frozen, clock); break; case AZ_BAD_SUPER_HORNET: az_draw_bad_super_hornet(baddie, frozen, clock); break; case AZ_BAD_KILOFUGE: az_draw_bad_kilofuge(baddie, clock); break; case AZ_BAD_ICE_CRYSTAL: az_draw_bad_ice_crystal(baddie); break; case AZ_BAD_SWITCHER: az_draw_bad_switcher(baddie, frozen, clock); break; case AZ_BAD_FAST_BOUNCER: az_draw_bad_fast_bouncer(baddie, frozen, clock); break; case AZ_BAD_PROXY_MINE: draw_mine_arms(15, flare, frozen); // Body: glBegin(GL_TRIANGLE_FAN); { glColor3f(0.65 + 0.35 * flare - 0.3 * frozen, 0.65 - 0.3 * flare, 0.65 - 0.3 * flare + 0.35 * frozen); glVertex2f(0, 0); glColor3f(0.35 + 0.3 * flare - 0.15 * frozen, 0.35 - 0.15 * flare, 0.35 - 0.15 * flare + 0.3 * frozen); for (int i = 0; i <= 360; i += 15) { glVertex2d(7 * cos(AZ_DEG2RAD(i)), 7 * sin(AZ_DEG2RAD(i))); } } glEnd(); // Light bulb: glBegin(GL_TRIANGLE_FAN); { if (baddie->state == 1 && az_clock_mod(2, 3, clock)) { glColor3f(1, 0.6, 0.5); } else glColor3f(0.2, 0.2, 0.2); glVertex2f(0, 0); glColor3f(0, 0, 0); for (int i = 0; i <= 360; i += 20) { glVertex2d(3 * cos(AZ_DEG2RAD(i)), 3 * sin(AZ_DEG2RAD(i))); } } glEnd(); break; case AZ_BAD_NIGHTSHADE: az_draw_bad_nightshade(baddie, frozen, clock); break; case AZ_BAD_AQUATIC_CHOMPER: az_draw_bad_aquatic_chomper(baddie, frozen, clock); break; case AZ_BAD_SMALL_FISH: az_draw_bad_small_fish(baddie, frozen, clock); break; case AZ_BAD_NOCTURNE: az_draw_bad_nocturne(baddie, clock); break; case AZ_BAD_MYCOFLAKKER: az_draw_bad_mycoflakker(baddie, frozen, clock); break; case AZ_BAD_MYCOSTALKER: az_draw_bad_mycostalker(baddie, frozen, clock); break; case AZ_BAD_OTH_CRAWLER: az_draw_bad_oth_crawler(baddie, frozen, clock); break; case AZ_BAD_FIRE_CRAWLER: az_draw_bad_fire_crawler(baddie, frozen, clock); break; case AZ_BAD_JUNGLE_CRAWLER: az_draw_bad_jungle_crawler(baddie, frozen, clock); break; case AZ_BAD_FORCE_EGG: az_draw_bad_force_egg(baddie); break; case AZ_BAD_FORCELING: az_draw_bad_forceling(baddie, frozen, clock); break; case AZ_BAD_JUNGLE_CHOMPER: az_draw_bad_jungle_chomper(baddie, frozen, clock); break; case AZ_BAD_SMALL_AUV: az_draw_bad_small_auv(baddie, frozen, clock); break; case AZ_BAD_SENSOR_LASER: az_draw_bad_sensor_laser(baddie, frozen, clock); break; case AZ_BAD_ERUPTION: draw_eruption_bubble(10.0, 47, clock); glPushMatrix(); { glTranslatef(0, -9, 0); draw_eruption_bubble(5.0, 23, clock); } glPopMatrix(); glPushMatrix(); { glTranslatef(0, 8, 0); draw_eruption_bubble(6.0, 27, clock); } glPopMatrix(); break; case AZ_BAD_PYROFLAKKER: az_draw_bad_pyroflakker(baddie, frozen, clock); break; case AZ_BAD_PYROSTALKER: az_draw_bad_pyrostalker(baddie, frozen, clock); break; case AZ_BAD_DEMON_SWOOPER: az_draw_bad_demon_swooper(baddie, frozen, clock); break; case AZ_BAD_FIRE_CHOMPER: az_draw_bad_fire_chomper(baddie, frozen, clock); break; case AZ_BAD_GRABBER_PLANT: az_draw_bad_grabber_plant(baddie, frozen, clock); break; case AZ_BAD_POP_OPEN_TURRET: az_draw_bad_pop_open_turret(baddie, frozen, clock); break; case AZ_BAD_GNAT: az_draw_bad_gnat(baddie, frozen, clock); break; case AZ_BAD_CREEPY_EYE: az_draw_bad_creepy_eye(baddie, frozen, clock); break; case AZ_BAD_BOMB_SENSOR: az_draw_bad_bomb_sensor(baddie, frozen, clock); break; case AZ_BAD_ROCKET_SENSOR: az_draw_bad_rocket_sensor(baddie, frozen, clock); break; case AZ_BAD_SPIKED_VINE: az_draw_bad_spiked_vine(baddie, frozen, clock); break; case AZ_BAD_MAGBEEST_HEAD: az_draw_bad_magbeest_head(baddie, clock); break; case AZ_BAD_MAGBEEST_LEGS_L: az_draw_bad_magbeest_legs_l(baddie, clock); break; case AZ_BAD_MAGBEEST_LEGS_R: az_draw_bad_magbeest_legs_r(baddie, clock); break; case AZ_BAD_MAGMA_BOMB: az_draw_bad_magma_bomb(baddie, clock); break; case AZ_BAD_OTH_BRAWLER: az_draw_bad_oth_brawler(baddie, frozen, clock); break; case AZ_BAD_LARGE_FISH: az_draw_bad_large_fish(baddie, frozen, clock); break; case AZ_BAD_CRAB_CRAWLER: az_draw_bad_crab_crawler(baddie, frozen, clock); break; case AZ_BAD_SCRAP_METAL: az_draw_bad_scrap_metal(baddie); break; case AZ_BAD_RED_ATOM: az_draw_bad_red_atom(baddie, frozen, clock); break; case AZ_BAD_REFLECTION: az_draw_bad_reflection(baddie, clock); break; case AZ_BAD_OTH_MINICRAB: az_draw_bad_oth_minicrab(baddie, frozen, clock); break; case AZ_BAD_OTH_RAZOR_2: az_draw_bad_oth_razor_2(baddie, frozen, clock); break; case AZ_BAD_OTH_SUPERGUNSHIP: case AZ_BAD_OTH_DECOY: az_draw_bad_oth_supergunship(baddie, frozen, clock); break; case AZ_BAD_CENTRAL_NETWORK_NODE: az_draw_bad_central_network_node(baddie, clock); break; case AZ_BAD_OTH_TENTACLE: az_draw_bad_oth_tentacle(baddie, frozen, clock); break; } }