/* Draw the pawn */ void draw_pawn(int coord_x, int coord_y, char color) { if(color == 'w') { GrSetGCForeground(tuxchess_gc,GR_RGB(255,255,255)); GrFillEllipse(tuxchess_wid,tuxchess_gc,coord_x+6,coord_y+6,2,4); GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrEllipse(tuxchess_wid,tuxchess_gc,coord_x+6,coord_y+6,2,4); GrSetGCForeground(tuxchess_gc,GR_RGB(255,255,255)); GrFillRect(tuxchess_wid,tuxchess_gc,coord_x+3,coord_y+9,7,3); GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrRect(tuxchess_wid,tuxchess_gc,coord_x+3,coord_y+9,7,3); } else { GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrFillEllipse(tuxchess_wid,tuxchess_gc,coord_x+6,coord_y+6,2,4); GrSetGCForeground(tuxchess_gc,GR_RGB(160,160,160)); GrEllipse(tuxchess_wid,tuxchess_gc,coord_x+6,coord_y+6,2,4); GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrFillRect(tuxchess_wid,tuxchess_gc,coord_x+3,coord_y+9,7,3); GrSetGCForeground(tuxchess_gc,GR_RGB(160,160,160)); GrRect(tuxchess_wid,tuxchess_gc,coord_x+3,coord_y+9,7,3); } }
/* Draw the pawn */ void draw_pawn(int coord_x, int coord_y, int color) { if(color == 0) { GrSetGCForeground(tuxchess_gc,WHITE); GrFillEllipse(tuxchess_wid,tuxchess_gc,coord_x+6,coord_y+6,2,4); GrSetGCForeground(tuxchess_gc,BLACK); GrEllipse(tuxchess_wid,tuxchess_gc,coord_x+6,coord_y+6,2,4); GrSetGCForeground(tuxchess_gc,WHITE); GrFillRect(tuxchess_wid,tuxchess_gc,coord_x+3,coord_y+9,7,3); GrSetGCForeground(tuxchess_gc,BLACK); GrRect(tuxchess_wid,tuxchess_gc,coord_x+3,coord_y+9,7,3); } else { GrSetGCForeground(tuxchess_gc,BLACK); GrFillEllipse(tuxchess_wid,tuxchess_gc,coord_x+6,coord_y+6,2,4); GrSetGCForeground(tuxchess_gc,LTGRAY); GrEllipse(tuxchess_wid,tuxchess_gc,coord_x+6,coord_y+6,2,4); GrSetGCForeground(tuxchess_gc,BLACK); GrFillRect(tuxchess_wid,tuxchess_gc,coord_x+3,coord_y+9,7,3); GrSetGCForeground(tuxchess_gc,LTGRAY); GrRect(tuxchess_wid,tuxchess_gc,coord_x+3,coord_y+9,7,3); } }
static void RefreshWindow(void) { int xpos, ypos; GrSetGCForeground(gc1, WHITE); GrSetGCBackground(gc1, RED); /* draw the buttons */ GrRect(buttons, gc1, 0, 0, (calc_width - 12)/2, 34); GrRect(buttons, gc1, (calc_width - 8)/2, 0, (calc_width - 12)/2, 34); #if 0 /* for when center align text works */ GrText(buttons, gc1, (calc_width - 10)/4, 22, "Again", 5, 0); GrText(buttons, gc1, (calc_width - 10)*3/4, 22, "Quit", 4, 0); #else GrText(buttons, gc1, 5, 22, "Again", 5, 0); GrText(buttons, gc1, (calc_width / 2) + 5, 22, "Quit", 4, 0); #endif /* draw the tiles */ for (ypos=0; ypos< HEIGHT_IN_TILES; ypos++){ for (xpos=0; xpos< WIDTH_IN_TILES; xpos++){ DrawTile(xpos, ypos); } } }
static void video_draw_pause() { GrSetGCForeground(video_gc, GR_RGB(255,255,255)); GrFillRect(video_wid, video_gc, 8, 8, 16, 32); GrFillRect(video_wid, video_gc, 32, 8, 16, 32); GrSetGCForeground(video_gc, GR_RGB(0,0,0)); GrRect(video_wid, video_gc, 8, 8, 16, 32); GrRect(video_wid, video_gc, 32, 8, 16, 32); }
/* Draw the cursor */ void draw_cursor(char coord1, char coord2) { int x,y; x = (coord1-65)*13; y = 106-((coord2-48)*13); GrSetGCForeground(tuxchess_gc,GR_RGB(255,255,255)); GrRect(tuxchess_wid,tuxchess_gc,x,y,13,13); GrSetGCForeground(tuxchess_gc,GR_RGB(0,0,0)); GrRect(tuxchess_wid,tuxchess_gc,x+1,y+1,11,11); GrSetGCForeground(tuxchess_gc,GR_RGB(255,255,255)); GrRect(tuxchess_wid,tuxchess_gc,x+2,y+2,9,9); }
/* Draw the cursor */ void tuxchess_draw_cursor(int coord_x, int coord_y) { GR_COLOR colour; colour = (is_photo==0) ? WHITE : LIGHT_BLUE; GrSetGCForeground(tuxchess_gc,colour); GrRect(tuxchess_wid,tuxchess_gc,coord_x,coord_y,13,13); colour = (is_photo==0) ? BLACK : DARK_BLUE; GrSetGCForeground(tuxchess_gc,colour); GrRect(tuxchess_wid,tuxchess_gc,coord_x+1,coord_y+1,11,11); colour = (is_photo==0) ? WHITE : LIGHT_BLUE; GrSetGCForeground(tuxchess_gc,colour); GrRect(tuxchess_wid,tuxchess_gc,coord_x+2,coord_y+2,9,9); }
// draw the selector rectangle static void draw_cursor() { show_cursor=1; cursor_x = level[current_depth].cursor_pos%selection_size; cursor_y = level[current_depth].cursor_pos/selection_size; // update the screen with last picture GrCopyArea(mandel_wid, mandel_gc, 0, 0, screen_width, screen_height, level[current_depth].mandel_buffer, 0, 0, MWROP_SRCCOPY); GrSetGCForeground(mandel_gc, GR_RGB(BLACK)); GrRect(mandel_wid, mandel_gc, cursor_x*selection_width-1, cursor_y*selection_height-1, selection_width+2, selection_height+2); GrSetGCForeground(mandel_gc, GR_RGB(WHITE)); GrRect(mandel_wid, mandel_gc, cursor_x*selection_width-2, cursor_y*selection_height-2, selection_width+4, selection_height+4); }
void PlayerDeadMessage (void) { if (gameStates.app.bPlayerExploded) { tHUDMessage *pMsgs = gameData.hud.msgs; if ( gameData.multi.players [gameData.multi.nLocalPlayer].lives < 2) { int x, y, w, h, aw; GrSetCurFont ( HUGE_FONT); GrGetStringSize ( TXT_GAME_OVER, &w, &h, &aw); w += 20; h += 8; x = (grdCurCanv->cv_w - w) / 2; y = (grdCurCanv->cv_h - h) / 2; NO_DFX (gameStates.render.grAlpha = 2*7); NO_DFX (GrSetColorRGB (0, 0, 0, 255)); NO_DFX (GrRect ( x, y, x+w, y+h)); gameStates.render.grAlpha = GR_ACTUAL_FADE_LEVELS; GrString (0x8000, (grdCurCanv->cv_h - grdCurCanv->cv_font->ft_h)/2 + h/8, TXT_GAME_OVER); #if 0 // Automatically exit death after 10 secs if ( gameData.time.xGame > gameStates.app.nPlayerTimeOfDeath + F1_0*10) { SetFunctionMode (FMODE_MENU); gameData.app.nGameMode = GM_GAME_OVER; longjmp ( gameExitPoint, 1); // Exit out of game loop } #endif } GrSetCurFont (GAME_FONT); if (pMsgs->nColor == -1) pMsgs->nColor = RGBA_PAL2 (0, 28, 0); GrSetFontColorRGBi (pMsgs->nColor, 1, 0, 0); GrString (0x8000, grdCurCanv->cv_h- (grdCurCanv->cv_font->ft_h+3), TXT_PRESS_ANY_KEY); } }
/* draws the scrollbar; calculates it and all */ void menu_draw_scrollbar(menu_st *menulist) { int per = menulist->screen_items * 100 / menulist->num_items; int height = (menulist->h - 2) * (per < 3 ? 3 : per) / 100; int y_top = ((((menulist->h - 3) - height) * 100) * menulist->sel / (menulist->num_items - 1)) / 100 + menulist->y + 1; int y_bottom = y_top + height; /* only draw if appropriate */ if(menulist->screen_items >= menulist->num_items) return; /* draw the containing box */ GrSetGCForeground(menulist->menu_gc, appearance_get_color( CS_SCRLBDR )); GrRect(menulist->menu_wid, menulist->menu_gc, menulist->w - 8, menulist->y, 8, menulist->h - 1); /* erase the scrollbar */ GrSetGCForeground(menulist->menu_gc, appearance_get_color( CS_SCRLCTNR )); GrFillRect(menulist->menu_wid, menulist->menu_gc, menulist->w - (8 - 1), menulist->y + 1, (8 - 2), y_top - (menulist->y + 1)); GrFillRect(menulist->menu_wid, menulist->menu_gc, menulist->w - (8 - 1), y_bottom, (8 - 2), (menulist->h - 3) - y_bottom); /* draw the bar */ GrSetGCForeground(menulist->menu_gc, appearance_get_color( CS_SCRLKNOB )); GrFillRect(menulist->menu_wid, menulist->menu_gc, menulist->w - (8 - 1), y_top, (8 - 2), height); /* restore the fg */ GrSetGCForeground(menulist->menu_gc, BLACK); }
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); }
static void GrRectWrapper(void *r) { nxRectReq *req = r; GrRect(req->drawid, req->gcid, req->x, req->y, req->width, req->height); }
U0 Main() { "Julia Set Generator\n"; SettingsPush; I64 k,j; CBGR bgr; for (k=0; k<16; k++) { j=0xFF*k/15; bgr.b=j; bgr.g=j; bgr.r=j; SetVGAPaletteColor(k, bgr); } CDC *dc=DCAlias; I64 row, col; for (row=0; row<ROWS; row++) { for (col=0; col<COLS; col++) { F64 r=LEFT+ToF64(COL_INC*col), i=BOTTOM+ToF64(ROW_INC*row); dc->color=getColor(-0.8, 0.156, r, i); I64 x=col*(640/COLS), y=row*(480/ROWS); GrRect(dc, x, y, 640/COLS, 480/ROWS); } } PressAKey; DCFill(dc); DCDel(dc); SettingsPop; }
void periodic_draw_element(GR_WINDOW_ID wid, GR_GC_ID gc, int i, int bx, int by, int cellsize) { int ex = (bx+((periodic_elements[i].group-1)*cellsize)); int ey = (by+((periodic_elements[i].period-1)*cellsize)); int tx, ty; char tt[4]; if (i == periodic_sel) { GrSetGCForeground(gc, GR_RGB(0,0,0)); GrFillRect(wid, gc, ex, ey, cellsize+1, cellsize+1); GrSetGCForeground(gc, GR_RGB(255,255,255)); } else { if (screen_info.bpp < 8) { GrSetGCForeground(gc, periodic_color_palette_bw[periodic_elements[i].color]); } else { GrSetGCForeground(gc, periodic_color_palette[periodic_elements[i].color]); } GrFillRect(wid, gc, ex, ey, cellsize+1, cellsize+1); GrSetGCForeground(gc, GR_RGB(0,0,0)); GrRect(wid, gc, ex, ey, cellsize+1, cellsize+1); } if (cellsize >= 8) { strcpy(tt, periodic_elements[i].symbol); if (strlen(tt) > 2) { tt[1] = tt[strlen(tt)-1]; tt[2] = 0; tx = ex + cellsize/2 - 4; } else if (tt[1] != 0) { tx = ex + cellsize/2 - 4; } else { tx = ex + cellsize/2 - 2; } ty = ey + cellsize/2 - 4; periodic_tinyfont_draw_string(wid, gc, tx, ty, tt); } }
void PlayerDeadMessage (void) { if (gameOpts->render.cockpit.bHUDMsgs && gameStates.app.bPlayerExploded) { tHUDMessage *pMsgs = gameData.hud.msgs; if ( LOCALPLAYER.lives < 2) { int x, y, w, h, aw; GrSetCurFont ( HUGE_FONT); GrGetStringSize ( TXT_GAME_OVER, &w, &h, &aw); w += 20; h += 8; x = (grdCurCanv->cv_w - w) / 2; y = (grdCurCanv->cv_h - h) / 2; NO_DFX (gameStates.render.grAlpha = 2*7); NO_DFX (GrSetColorRGB (0, 0, 0, 255)); NO_DFX (GrRect ( x, y, x+w, y+h)); gameStates.render.grAlpha = GR_ACTUAL_FADE_LEVELS; GrString (0x8000, (grdCurCanv->cv_h - grdCurCanv->cvFont->ftHeight)/2 + h/8, TXT_GAME_OVER); #if 0 // Automatically exit death after 10 secs if ( gameData.time.xGame > gameStates.app.nPlayerTimeOfDeath + F1_0*10) { SetFunctionMode (FMODE_MENU); gameData.app.nGameMode = GM_GAME_OVER; __asm int 3; longjmp ( gameExitPoint, 1); // Exit out of game loop }
int XDrawRectangle(Display *display, Drawable d, GC gc, int x, int y, unsigned int width, unsigned int height) { /* X11 width/height is one less than Nano-X width/height*/ GrRect(d, gc->gid, x, y, width+1, height+1); return 1; }
//------------------------------------------------------------------------------ // Function Name : ui_draw_rect() // Description : //------------------------------------------------------------------------------ void ui_draw_rect(int x, int y, int w, int h, u32 co, int fill) { GrSetGCForeground(g_gc, co); if (fill) GrFillRect(g_wid, g_gc, x, y, w, h); else GrRect(g_wid, g_gc, x, y, w, h); }
void SBShowScoreAdded (void) { int x, w, h, aw, color, frc = 0; char szScore [32]; static int lastX [4]={SB_SCORE_RIGHT_L, SB_SCORE_RIGHT_L, SB_SCORE_RIGHT_H, SB_SCORE_RIGHT_H}; static int last_score_display [2] = {-1, -1}; static int nIdTotalScore = 0; if (IsMultiGame && !IsCoopGame) return; if (scoreDisplay [gameStates.render.vr.nCurrentPage] == 0) return; GrSetCurFont (GAME_FONT); scoreTime -= gameData.time.xFrame; if (scoreTime > 0) { if (scoreDisplay [gameStates.render.vr.nCurrentPage] != last_score_display [gameStates.render.vr.nCurrentPage] || frc) { GrSetColorRGBi (RGBA_PAL (0, 0, 0)); GrRect (lastX [(gameStates.video.nDisplayMode?2:0)+gameStates.render.vr.nCurrentPage], SB_SCORE_ADDED_Y, SB_SCORE_ADDED_RIGHT, SB_SCORE_ADDED_Y+GAME_FONT->ftHeight); last_score_display [gameStates.render.vr.nCurrentPage] = scoreDisplay [gameStates.render.vr.nCurrentPage]; } color = f2i (scoreTime * 20) + 10; if (color < 10) color = 10; else if (color > 31) color = 31; if (gameStates.app.cheats.bEnabled) sprintf (szScore, "%s", TXT_CHEATER); else sprintf (szScore, "%5d", scoreDisplay [gameStates.render.vr.nCurrentPage]); GrGetStringSize (szScore, &w, &h, &aw); x = SB_SCORE_ADDED_RIGHT-w-HUD_LHX (2); GrSetFontColorRGBi (RGBA_PAL2 (0, color, 0), 1, 0, 0); nIdTotalScore = GrPrintF (&nIdTotalScore, x, SB_SCORE_ADDED_Y, szScore); lastX [(gameStates.video.nDisplayMode?2:0)+gameStates.render.vr.nCurrentPage] = x; } else { //erase old score GrSetColorRGBi (RGBA_PAL (0, 0, 0)); GrRect (lastX [(gameStates.video.nDisplayMode?2:0)+gameStates.render.vr.nCurrentPage], SB_SCORE_ADDED_Y, SB_SCORE_ADDED_RIGHT, SB_SCORE_ADDED_Y+GAME_FONT->ftHeight); scoreTime = 0; scoreDisplay [gameStates.render.vr.nCurrentPage] = 0; } }
/* * Draw or erase the current selection if any is defined. * The selection is a rectangle centered on a specified point, and with a * specified width and height. Drawing and erasing the selection are the * same drawing operation because of the XOR operation. */ static void showselection(GR_BOOL show) { if ((show == 0) == (selectvisible == 0)) return; if (selectmode == SELECT_NONE) return; GrRect(mapwid, xorgc, selectx - selectwidth / 2, selecty - selectheight / 2, selectwidth, selectheight); selectvisible = show; }
void print_diagnostic( char message[DIAGNOSTIC_MESSAGE_MAX] ) { int w,h,aw; GrSetCurrentCanvas( NULL ); GrSetCurFont(editor_font); GrSetFontColor( CBLACK, CGREY ); GrGetStringSize( message, &w, &h, &aw ); GrString( 4, 583, message ); GrSetFontColor( CBLACK, CWHITE ); GrSetColor( CGREY ); GrRect( 4+w, 583, 799, 599 ); }
U0 DrawSliderCtrl(CDC *dc,CCtrl *c) { CSliderState *s=c->state; dc->color=LTRED; GrRect(dc, c->left,c->top,SLIDER_SPACING*3+2,SLIDER_SPACING*2+SLIDER_RANGE); dc->color=BLUE; GrRect(dc, c->left+SLIDER_BORDER,c->top+SLIDER_BORDER, SLIDER_SPACING*3+2-2*SLIDER_BORDER,SLIDER_SPACING*2+SLIDER_RANGE-2*SLIDER_BORDER); dc->color=BLACK; GrLine(dc,c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING, c->left+1*SLIDER_SPACING+0,c->top+SLIDER_SPACING+SLIDER_RANGE-1); GrLine(dc,c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING, c->left+2*SLIDER_SPACING+1,c->top+SLIDER_SPACING+SLIDER_RANGE-1); dc->color=LTRED; GrPrintF(dc,c->left+1*SLIDER_SPACING+0-FONT_WIDTH/2, c->top+SLIDER_SPACING+SLIDER_RANGE+3, "%d",s->left_pos*10/SLIDER_RANGE); GrPrintF(dc,c->left+2*SLIDER_SPACING+1-FONT_WIDTH/2, c->top+SLIDER_SPACING+SLIDER_RANGE+3, "%d",s->right_pos*10/SLIDER_RANGE); GrRect(dc,c->left+1*SLIDER_SPACING+0-3,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-2,7,5); GrRect(dc,c->left+2*SLIDER_SPACING+1-3,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-2,7,5); dc->color=YELLOW; GrRect(dc,c->left+1*SLIDER_SPACING+0-2,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->left_pos-1,5,3); GrRect(dc,c->left+2*SLIDER_SPACING+1-2,c->top+SLIDER_SPACING+SLIDER_RANGE-1-s->right_pos-1,5,3); }
static void video_draw_searchbar() { int height = .1 * video_screenHeight; int offX; offX = (int)((double)((double)video_curPosition/mainHeader.dwTotalFrames) * (video_screenWidth-30)) + 16; GrSetGCForeground(video_gc, GR_RGB(255,255,255)); GrFillRect(video_wid, video_gc, 16, video_screenHeight-2 * height, video_screenWidth-30+6, height); GrSetGCForeground(video_gc, GR_RGB(0,0,0)); GrRect(video_wid, video_gc, 16, video_screenHeight-2 * height, video_screenWidth-30+6, height); GrFillRect(video_wid, video_gc, offX, video_screenHeight-2*height, 5, height); }
void CObjectRect::Draw() { if(m_wid && m_gc) { GrSetGCForeground(m_gc, m_Color); if(m_isFill) { GrFillRect(m_wid, m_gc, m_rect.x, m_rect.y, m_rect.w, m_rect.h); } else if(m_isDash) { GrSetGCLineAttributes(m_gc, GR_LINE_ONOFF_DASH); GrSetGCDash(m_gc, g_dash_patern, 2); GrRect(m_wid, m_gc, m_rect.x, m_rect.y, m_rect.w, m_rect.h); GrSetGCLineAttributes(m_gc, GR_LINE_SOLID); } else { GrRect(m_wid, m_gc, m_rect.x, m_rect.y, m_rect.w, m_rect.h); } } }
static void video_status_message(char *msg) { GR_SIZE txt_width, txt_height, txt_base; GR_COORD txt_x, txt_y; GrGetGCTextSize(video_gc, msg, -1, GR_TFASCII, &txt_width, &txt_height, &txt_base); txt_x = (screen_info.cols - (txt_width + 10)) >> 1; txt_y = (screen_info.rows - (txt_height + 10)) >> 1; GrSetGCForeground(video_gc, GR_RGB(255,255,255)); GrFillRect(video_wid, video_gc, txt_x, txt_y, txt_width + 10, txt_height + 10); GrSetGCForeground(video_gc, GR_RGB(0,0,0)); GrRect(video_wid, video_gc, txt_x, txt_y, txt_width + 10, txt_height + 10); GrText(video_wid, video_gc, txt_x + 5, txt_y + txt_base + 5, msg, -1, GR_TFASCII); }
int XDrawRectangles(Display *display, Drawable d, GC gc, XRectangle *rect, int nrect) { int i; for (i = 0; i < nrect; i++) { /* X11 width/height is one less than Nano-X width/height*/ GrRect(d, gc->gid, rect->x, rect->y, rect->width+1, rect->height+1); ++rect; } return 1; }
void editor_sub_status( const char *format, ... ) { int w,h,aw; va_list ap; va_start(ap, format); vsprintf(sub_status_line, format, ap); va_end(ap); GrSetCurrentCanvas( NULL ); GrSetCurFont(editor_font); GrSetFontColor( BM_XRGB(0,0,31), CGREY ); GrGetStringSize( sub_status_line, &w, &h, &aw ); GrString( 500, 583, sub_status_line ); GrSetFontColor( CBLACK, CWHITE ); GrSetColor( CGREY ); GrRect( 500+w, 583, 799, 599 ); }
// Draws a box with the score a person got and their high score. static void draw_result() { char strScore[30]; char strHighScore[35]; int height, width, base; sprintf(strScore, "Score:%li", score); if (highScore < score) highScore = score; sprintf(strHighScore, "High Score:%li", highScore); GrGetGCTextSize(tunnel_gc, strHighScore, -1, GR_TFASCII, &width, &height, &base); GrSetGCForeground(tunnel_gc, WHITE); GrFillRect(tunnel_wid, tunnel_gc, (wi.width - width) / 2 - 3, wi.height / 2 - height - 3, width + 8, height * 2 + 2); GrSetGCForeground(tunnel_gc, BLACK); GrRect(tunnel_wid, tunnel_gc, (wi.width - width) / 2 - 3, wi.height / 2 - height - 3, width + 8, height * 2 + 2); GrText (tunnel_wid, tunnel_gc, (wi.width - width) / 2, wi.height / 2 - height / 2 + 2, strScore, -1, GR_TFASCII ); GrText (tunnel_wid, tunnel_gc, (wi.width - width) / 2, wi.height / 2 + height / 2 + 2, strHighScore, -1, GR_TFASCII ); }
static void mp3_do_draw() { GrSetGCForeground(mp3_gc, GR_RGB(255,255,255)); GrFillRect(mp3_wid, mp3_gc, 0, 0, screen_info.cols, screen_info.rows); GrSetGCForeground(mp3_gc, GR_RGB(0,0,0)); GrText(mp3_wid, mp3_gc, 8, 20, current_pos, -1, GR_TFASCII); GrText(mp3_wid, mp3_gc, 8, 34, current_title, -1, GR_TFASCII); GrText(mp3_wid, mp3_gc, 8, 48, current_artist, -1, GR_TFASCII); GrText(mp3_wid, mp3_gc, 8, 62, current_album, -1, GR_TFASCII); rect_x1 = 8; rect_x2 = screen_info.cols - 8; rect_y1 = screen_info.rows - (HEADER_TOPLINE + 1) - 18; rect_y2 = screen_info.rows - (HEADER_TOPLINE + 1) - 8; GrRect(mp3_wid, mp3_gc, rect_x1, rect_y1, rect_x2-rect_x1, rect_y2-rect_y1); rect_wait = 0; draw_time(); }
static void dialer_do_draw() { int i; GR_SIZE width, height, base; pz_draw_header(_("Rose Quartz Box")); digitdisplay[0]='\0'; numfull = 0; littr = 0; GrSetGCForeground(dialer_gc, GR_RGB(0,0,0)); for(i=0; i<=15; i++) { GrGetGCTextSize(dialer_gc, dialerpad[i], -1, GR_TFASCII, &width, &height, &base); GrRect(dialer_wid, dialer_gc,CXOFF+((cbw+cxgap)*(i%4)), CBYOFF+((cbh+cygap)*(i/4)), cbw, cbh); GrText(dialer_wid, dialer_gc, CXOFF+((cbw+cxgap)*(i%4))+((cbw/2)-(width/2)), CBYOFF+((cbh+cygap)*(i/4))+((cbh/2)-(height/2)), dialerpad[i], -1, GR_TFASCII|GR_TFTOP); } draw_dialer(); }
static void msg_do_draw() { GR_WINDOW_INFO winfo; int i; GrGetWindowInfo(msg_wid, &winfo); /* fill the background */ GrSetGCForeground(msg_gc, appearance_get_color( (this_is_error)?CS_ERRORBG:CS_MESSAGEBG )); GrFillRect( msg_wid, msg_gc, 0, 0, winfo.width, winfo.height ); GrSetGCForeground(msg_gc, appearance_get_color( CS_MESSAGELINE )); GrRect(msg_wid, msg_gc, 1, 1, winfo.width - 2, winfo.height - 2); GrSetGCForeground(msg_gc, appearance_get_color( CS_MESSAGEFG )); for(i=linenum; i; i--) GrText(msg_wid, msg_gc, 5, (((winfo.height-10) / linenum) * i), msglines[i-1], -1, GR_TFASCII); }
void generator_draw_volume() { //erase just the volume bar (prevent flickering) GrSetGCForeground( generator_gc, WHITE); GrFillRect( generator_wid, generator_gc, 10, screen_info.rows - HEADER_TOPLINE - 16, screen_info.cols - 20, 8 ); if( generator_mode==GENERATOR_MODE_VOLUME) { //get the volume int volume = dsp_get_volume(&dspz); //calculate the bar length for the volume int volume_length = ((screen_info.cols - 22) * volume) / 100; //draw the volume border GrSetGCForeground( generator_gc, BLACK); GrRect( generator_wid, generator_gc, 10, screen_info.rows - HEADER_TOPLINE - 16, screen_info.cols - 20, 8 ); //draw the volume inside GrSetGCForeground( generator_gc, GRAY); GrFillRect( generator_wid, generator_gc, 11, screen_info.rows - HEADER_TOPLINE - 15, volume_length, 6 ); } }