static void draw_screen(void) { GR_POINT tri[4] = { {5, 115}, {105, 115}, {55, 200}, {5, 115} }; GR_WINDOW_INFO winfo; GR_GC_ID gc; char dash1[2] = { 10, 5 }; char dash2[4] = { 5, 2, 1, 2 }; char dash3[4] = { 5, 2, 5, 5 }; char dash4[2] = { 2, 2 }; GrGetWindowInfo(g_main, &winfo); /* Draw several lines and a few boxes */ gc = GrNewGC(); GrSetGCLineAttributes(gc, GR_LINE_ONOFF_DASH); /* Draw a dashed box */ GrSetGCDash(gc, dash1, 2); GrRect(g_main, gc, 5, 5, 100, 100); GrSetGCDash(gc, dash2, 4); GrLine(g_main, gc, 10, 10, 95, 95); GrSetGCDash(gc, dash3, 4); GrEllipse(g_main, gc, 160, 55, 50, 50); GrSetGCDash(gc, dash4, 2); GrPoly(g_main, gc, 4, tri); GrDestroyGC(gc); }
/* Draw the rook */ void draw_rook(int coord_x, int coord_y, char color) { GR_POINT rook[] = { {coord_x+1, coord_y+1}, {coord_x+3, coord_y+1}, {coord_x+3, coord_y+3}, {coord_x+5, coord_y+3}, {coord_x+5, coord_y+1}, {coord_x+7, coord_y+1}, {coord_x+7, coord_y+3}, {coord_x+9, coord_y+3}, {coord_x+9, coord_y+1}, {coord_x+11, coord_y+1}, {coord_x+11, coord_y+4}, {coord_x+9, coord_y+4}, {coord_x+9, coord_y+8}, {coord_x+11, coord_y+8}, {coord_x+11, coord_y+11}, {coord_x+1, coord_y+11}, {coord_x+1, coord_y+8}, {coord_x+3, coord_y+8}, {coord_x+3, coord_y+4}, {coord_x+1, coord_y+4}, {coord_x+1, coord_y+1} }; if(color == 'w') { GrSetGCForeground(tuxchess_gc,GR_RGB(255,255,255)); GrFillPoly(tuxchess_wid,tuxchess_gc,21,rook); GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrPoly(tuxchess_wid,tuxchess_gc,21,rook); } else { GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrFillPoly(tuxchess_wid,tuxchess_gc,21,rook); } }
/* Draw the rook */ void draw_rook(int coord_x, int coord_y, int color) { GR_POINT rook[] = { {coord_x+1, coord_y+1}, {coord_x+3, coord_y+1}, {coord_x+3, coord_y+3}, {coord_x+5, coord_y+3}, {coord_x+5, coord_y+1}, {coord_x+7, coord_y+1}, {coord_x+7, coord_y+3}, {coord_x+9, coord_y+3}, {coord_x+9, coord_y+1}, {coord_x+11, coord_y+1}, {coord_x+11, coord_y+4}, {coord_x+9, coord_y+4}, {coord_x+9, coord_y+8}, {coord_x+11, coord_y+8}, {coord_x+11, coord_y+11}, {coord_x+1, coord_y+11}, {coord_x+1, coord_y+8}, {coord_x+3, coord_y+8}, {coord_x+3, coord_y+4}, {coord_x+1, coord_y+4}, {coord_x+1, coord_y+1} }; if(color == 0) { GrSetGCForeground(tuxchess_gc,WHITE); GrFillPoly(tuxchess_wid,tuxchess_gc,21,rook); GrSetGCForeground(tuxchess_gc,BLACK); GrPoly(tuxchess_wid,tuxchess_gc,21,rook); } else { GrSetGCForeground(tuxchess_gc,BLACK); GrFillPoly(tuxchess_wid,tuxchess_gc,21,rook); } }
void steroids_polygon_draw (Steroids_Polygon *p, int clipMode, GR_WINDOW_ID wid) { // Draw polygon: GrPoly (wid, steroids_globals.game_gc, p->nPoints, p->point); }
static void GrPolyWrapper(void *r) { nxPolyReq *req = r; int count; count = GetReqVarLen(req) / sizeof(GR_POINT); GrPoly(req->drawid, req->gcid, count, (GR_POINT *)GetReqData(req)); }
/* Draw the queen */ void draw_queen(int coord_x, int coord_y, char color) { GR_POINT queen[] = { {coord_x+1, coord_y+1}, {coord_x+4, coord_y+4}, {coord_x+6, coord_y+1}, {coord_x+8, coord_y+4}, {coord_x+11, coord_y+1}, {coord_x+9, coord_y+10}, {coord_x+3, coord_y+10}, {coord_x+1, coord_y+1} }; if (color == 'w') { GrSetGCForeground(tuxchess_gc,GR_RGB(255,255,255)); GrFillPoly(tuxchess_wid,tuxchess_gc,8,queen); GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrPoly(tuxchess_wid,tuxchess_gc,8,queen); } else { GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrFillPoly(tuxchess_wid,tuxchess_gc,8,queen); GrPoly(tuxchess_wid,tuxchess_gc,8,queen); } }
/* Draw the queen */ void draw_queen(int coord_x, int coord_y, int color) { GR_POINT queen[] = { {coord_x+1, coord_y+1}, {coord_x+4, coord_y+4}, {coord_x+6, coord_y+1}, {coord_x+8, coord_y+4}, {coord_x+11, coord_y+1}, {coord_x+9, coord_y+10}, {coord_x+3, coord_y+10}, {coord_x+1, coord_y+1} }; if (color == 0) { GrSetGCForeground(tuxchess_gc,WHITE); GrFillPoly(tuxchess_wid,tuxchess_gc,8,queen); GrSetGCForeground(tuxchess_gc,BLACK); GrPoly(tuxchess_wid,tuxchess_gc,8,queen); } else { GrSetGCForeground(tuxchess_gc,BLACK); GrFillPoly(tuxchess_wid,tuxchess_gc,8,queen); GrPoly(tuxchess_wid,tuxchess_gc,8,queen); } }
/* Draw the knight */ void draw_knight(int coord_x, int coord_y, char color) { GR_POINT knight[] = { {coord_x+5, coord_y+1}, {coord_x+8, coord_y+3}, {coord_x+11, coord_y+11}, {coord_x+1, coord_y+11}, {coord_x+5, coord_y+9}, {coord_x+5, coord_y+4}, {coord_x+3, coord_y+6}, {coord_x+1, coord_y+6}, {coord_x+5, coord_y+1} }; if(color == 'w') { GrSetGCForeground(tuxchess_gc,GR_RGB(255,255,255)); GrFillPoly(tuxchess_wid,tuxchess_gc,9,knight); GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrPoly(tuxchess_wid,tuxchess_gc,9,knight); } else { GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrFillPoly(tuxchess_wid,tuxchess_gc,9,knight); GrPoly(tuxchess_wid,tuxchess_gc,9,knight); } }
/* Draw the knight */ void draw_knight(int coord_x, int coord_y, int color) { GR_POINT knight[] = { {coord_x+5, coord_y+1}, {coord_x+8, coord_y+3}, {coord_x+11, coord_y+11}, {coord_x+1, coord_y+11}, {coord_x+5, coord_y+9}, {coord_x+5, coord_y+4}, {coord_x+3, coord_y+6}, {coord_x+1, coord_y+6}, {coord_x+5, coord_y+1} }; if(color == 0) { GrSetGCForeground(tuxchess_gc,WHITE); GrFillPoly(tuxchess_wid,tuxchess_gc,9,knight); GrSetGCForeground(tuxchess_gc,BLACK); GrPoly(tuxchess_wid,tuxchess_gc,9,knight); } else { GrSetGCForeground(tuxchess_gc,BLACK); GrFillPoly(tuxchess_wid,tuxchess_gc,9,knight); GrPoly(tuxchess_wid,tuxchess_gc,9,knight); } }
/* Draw the bishop */ void draw_bishop(int coord_x, int coord_y, char color) { GR_POINT bishop1[] = { {coord_x+7, coord_y+1}, {coord_x+8, coord_y+4}, {coord_x+8, coord_y+7}, {coord_x+7, coord_y+10}, {coord_x+4, coord_y+10}, {coord_x+1, coord_y+7}, {coord_x+1, coord_y+5}, {coord_x+3, coord_y+3}, {coord_x+7, coord_y+1} }; GR_POINT bishop2[] = { {coord_x+10, coord_y+1}, {coord_x+11, coord_y+4}, {coord_x+11, coord_y+7}, {coord_x+10, coord_y+10}, {coord_x+7, coord_y+10}, {coord_x+4, coord_y+7}, {coord_x+4, coord_y+5}, {coord_x+6, coord_y+3}, {coord_x+10, coord_y+1} }; GR_POINT bishop3[] = { {coord_x+4, coord_y+10}, {coord_x+9, coord_y+10}, {coord_x+9, coord_y+12}, {coord_x+4, coord_y+12}, {coord_x+4, coord_y+10} }; if(color == 'w') { GrSetGCForeground(tuxchess_gc,GR_RGB(255,255,255)); GrFillPoly(tuxchess_wid,tuxchess_gc,9,bishop2); GrFillPoly(tuxchess_wid,tuxchess_gc,5,bishop3); GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrPoly(tuxchess_wid,tuxchess_gc,9,bishop2); GrPoly(tuxchess_wid,tuxchess_gc,5,bishop3); GrSetGCForeground(tuxchess_gc,GR_RGB(255,255,255)); GrFillPoly(tuxchess_wid,tuxchess_gc,9,bishop1); GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrPoly(tuxchess_wid,tuxchess_gc,9,bishop1); } else { GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrFillPoly(tuxchess_wid,tuxchess_gc,9,bishop2); GrFillPoly(tuxchess_wid,tuxchess_gc,5,bishop3); GrSetGCForeground(tuxchess_gc,GR_RGB(160,160,160)); GrPoly(tuxchess_wid,tuxchess_gc,9,bishop2); GrPoly(tuxchess_wid,tuxchess_gc,5,bishop3); GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrFillPoly(tuxchess_wid,tuxchess_gc,9,bishop1); GrSetGCForeground(tuxchess_gc,GR_RGB(160,160,160)); GrPoly(tuxchess_wid,tuxchess_gc,9,bishop1); } }
/* Draw the bishop */ void draw_bishop(int coord_x, int coord_y, int color) { GR_POINT bishop1[] = { {coord_x+7, coord_y+1}, {coord_x+8, coord_y+4}, {coord_x+8, coord_y+7}, {coord_x+7, coord_y+10}, {coord_x+4, coord_y+10}, {coord_x+1, coord_y+7}, {coord_x+1, coord_y+5}, {coord_x+3, coord_y+3}, {coord_x+7, coord_y+1} }; GR_POINT bishop2[] = { {coord_x+10, coord_y+1}, {coord_x+11, coord_y+4}, {coord_x+11, coord_y+7}, {coord_x+10, coord_y+10}, {coord_x+7, coord_y+10}, {coord_x+4, coord_y+7}, {coord_x+4, coord_y+5}, {coord_x+6, coord_y+3}, {coord_x+10, coord_y+1} }; GR_POINT bishop3[] = { {coord_x+4, coord_y+10}, {coord_x+9, coord_y+10}, {coord_x+9, coord_y+12}, {coord_x+4, coord_y+12}, {coord_x+4, coord_y+10} }; if(color == 0) { GrSetGCForeground(tuxchess_gc,WHITE); GrFillPoly(tuxchess_wid,tuxchess_gc,9,bishop2); GrFillPoly(tuxchess_wid,tuxchess_gc,5,bishop3); GrSetGCForeground(tuxchess_gc,BLACK); GrPoly(tuxchess_wid,tuxchess_gc,9,bishop2); GrPoly(tuxchess_wid,tuxchess_gc,5,bishop3); GrSetGCForeground(tuxchess_gc,WHITE); GrFillPoly(tuxchess_wid,tuxchess_gc,9,bishop1); GrSetGCForeground(tuxchess_gc,BLACK); GrPoly(tuxchess_wid,tuxchess_gc,9,bishop1); } else { GrSetGCForeground(tuxchess_gc,BLACK); GrFillPoly(tuxchess_wid,tuxchess_gc,9,bishop2); GrFillPoly(tuxchess_wid,tuxchess_gc,5,bishop3); GrSetGCForeground(tuxchess_gc,LTGRAY); GrPoly(tuxchess_wid,tuxchess_gc,9,bishop2); GrPoly(tuxchess_wid,tuxchess_gc,5,bishop3); GrSetGCForeground(tuxchess_gc,BLACK); GrFillPoly(tuxchess_wid,tuxchess_gc,9,bishop1); GrSetGCForeground(tuxchess_gc,LTGRAY); GrPoly(tuxchess_wid,tuxchess_gc,9,bishop1); } }