int d_aphoton_button_proc(int msg, DIALOG *d, int c) { int top_color, bottom_color, shift; if (msg == MSG_DRAW) { photon_container(screen, d->x, d->y, d->w, d->h); /* internal frame */ if (d->flags & D_SELECTED) { top_color = button_border_gray; bottom_color = white; shift = 1; } else { top_color = white; bottom_color = button_border_gray; shift = 0; } hline(screen, d->x+2, d->y+2, d->x+d->w-3, top_color); vline(screen, d->x+2, d->y+2, d->y+d->h-3, top_color); hline(screen, d->x+2, d->y+d->h-3, d->x+d->w-3, bottom_color); vline(screen, d->x+d->w-3, d->y+2, d->y+d->h-3, bottom_color); rectgouraud(screen, d->x+3, d->y+3, d->x+d->w-4, d->y+d->h-4, &button_gray_range, FALSE); if (d->dp) photon_textout(screen, (char *)d->dp, d->x+d->w/2+shift, d->y+d->h/2-text_height(font)/2+shift, d->flags, TRUE); return D_O_K; } return d_button_proc(msg, d, c); }
void Cpu::ft_putInfo(char const *label, float data, int line, int h, int w) const { if (data >= 75) { move((h / AModule::_maxY) * this->_Y + line, (w / AModule::_maxX) * this->_X); printw("%s:\t%4.1f%% ", label, data); attron(COLOR_PAIR(COLOR_RED)); hline(' ', data + 1); attroff(COLOR_PAIR(COLOR_RED)); } else if (data <= 71) { move((h / AModule::_maxY) * this->_Y + line, (w / AModule::_maxX) * this->_X); printw("%s:\t%4.1f%% ", label, data); attron(COLOR_PAIR(COLOR_GREEN)); hline(' ', data + 1); attroff(COLOR_PAIR(COLOR_GREEN)); } else { move((h / AModule::_maxY) * this->_Y + line, (w / AModule::_maxX) * this->_X); printw("%s:\t%4.1f%% ", label, data); attron(COLOR_PAIR(COLOR_ORANGE)); hline(' ', data + 1); attroff(COLOR_PAIR(COLOR_ORANGE)); } }
int sushi_draw_game_base(struct sushi_view *sv) { if((COLS > sv->wsize.x+2) && (LINES > sv->wsize.y+2)) { move(sv->org.y-1, sv->org.x-1); addch('+'); move(sv->org.y-1, sv->org.x); hline('-', sv->wsize.x); move(sv->org.y-1, sv->org.x + sv->wsize.x); addch('+'); move(sv->org.y + sv->wsize.y, sv->org.x-1); addch('+'); move(sv->org.y + sv->wsize.y, sv->org.x); hline('-', sv->wsize.x); move(sv->org.y + sv->wsize.y, sv->org.x + sv->wsize.x); addch('+'); move(sv->org.y, sv->org.x-1); vline('|', sv->wsize.y); move(sv->org.y, sv->org.x + sv->wsize.x); vline('|', sv->wsize.y); } move(sv->org.y + sv->gvsize.y, sv->org.x); hline('=', sv->wsize.x); refresh(); return SUSHI_SUCCESS; }
TileMap *create_bubble( std::vector<TileMap*> &landChunks ) { int ndx = ((float)rand() / (float)RAND_MAX) * landChunks.size(); TileMap *bub = new TileMap( landChunks[ndx]->m_size ); bub->bub_age = (float)rand() / (float)RAND_MAX; bub->paste( landChunks[ndx], 0, 0 ); int sz = bub->m_size * 12; BITMAP *tmpBmp = create_bitmap( sz, sz ); rectfill( tmpBmp, 0, 0, sz, sz, makecol( 0xff, 0x00, 0xff) ); bub->draw( tmpBmp, 0, 0, emptyObjs ); bub->bub_bmp = create_bitmap( 20, 20 ); stretch_blit( tmpBmp, bub->bub_bmp, 0, 0, tmpBmp->w, tmpBmp->h, 0, 0, bub->bub_bmp->w, bub->bub_bmp->h ); destroy_bitmap( tmpBmp ); circle( bub->bub_bmp, 10, 10, 9, makecol( 0x66, 0xee, 0xff ) ); circlefill( bub->bub_bmp, 6, 6, 2, makecol( 0xff, 0xff, 0xff ) ); hline( bub->bub_bmp, 2, 17, 18, makecol( 155, 193, 212 ) ); hline( bub->bub_bmp, 2, 18, 18, makecol( 0xff, 0x00, 0xff ) ); hline( bub->bub_bmp, 2, 19, 18, makecol( 0xff, 0x00, 0xff ) ); return bub; }
void GLOBALDATA::replace_canvas () { for (int32_t i = 0; i < lastUpdatesCount; ++i) { if ((lastUpdates[i].y + lastUpdates[i].h) > MENUHEIGHT) { blit (env.sky, canvas, lastUpdates[i].x, lastUpdates[i].y - MENUHEIGHT, lastUpdates[i].x, lastUpdates[i].y, lastUpdates[i].w, lastUpdates[i].h); masked_blit (terrain, canvas, lastUpdates[i].x, lastUpdates[i].y, lastUpdates[i].x, lastUpdates[i].y, lastUpdates[i].w, lastUpdates[i].h); } // End of having an update below the top bar } int32_t l = 0; int32_t r = env.screenWidth - 1; int32_t t = MENUHEIGHT; int32_t b = env.screenHeight - 1; vline(canvas, l, t, b, env.wallColour); // Left edge vline(canvas, l + 1, t, b, env.wallColour); // Left edge vline(canvas, r, t, b, env.wallColour); // right edge vline(canvas, r - 1, t, b, env.wallColour); // right edge hline(canvas, l, b, r, env.wallColour); // bottom edge if (env.isBoxed) hline(canvas, l, t, r, env.wallColour); // top edge lastUpdatesCount = 0; }
static void ase_rectedge(BITMAP *bmp, int x1, int y1, int x2, int y2, int fg, int bg) { hline(bmp, x1, y1, x2 - 1, fg); vline(bmp, x1, y1 + 1, y2 - 1, fg); hline(bmp, x1, y2, x2, bg); vline(bmp, x2, y1, y2 - 1, bg); }
void tile_draw(int x, int y, int c) { // draw a tile at x, y // basic rectangle rectfill(gBuff, x, y, x + T_SIZE - 1, y + T_SIZE - 1, c + 4); // top hline(gBuff, x + 1, y, x + T_SIZE - 2, c + 6); // bottom hline(gBuff, x + 1, y + T_SIZE - 1, x + T_SIZE - 2, c + 2); // left vline(gBuff, x, y + 1, y + T_SIZE - 2, c + 6); // right vline(gBuff, x + T_SIZE - 1, y + 1, y + T_SIZE - 2, c + 2); // top + 1 hline(gBuff, x + 1, y + 1, x + T_SIZE - 3, c + 5); // bottom - 1 hline(gBuff, x + 2, y + T_SIZE - 2, x + T_SIZE - 2, c + 3); // left + 1 vline(gBuff, x + 1, y + 2, y + T_SIZE - 3, c + 5); // right - 1 vline(gBuff, x + T_SIZE - 2, y + 2, y + T_SIZE - 3, c + 3); // top left corner putpixel(gBuff, x, y, c + 5); // bottom right corner putpixel(gBuff, x + T_SIZE - 1, y + T_SIZE - 1, c + 1); }
void Frame::draw_self() { // Diese hier machen das Zeichnen übersichtlicher. BITMAP* g = get_ground().get_al_bitmap(); const int x1 = get_x_here() - 2; const int y1 = get_y_here() - 2; const int x2 = get_x_here() + 1 + get_xl(); const int y2 = get_y_here() + 1 + get_yl(); // Farben wählen int col_1 = color[COL_API_D]; int col_3 = color[COL_API_L]; // Acquiren, malen, freilassen acquire_bitmap(g); vline (g, x1, y1, y2-1, col_1); // Links außen vline (g, x1+1, y1, y2-2, col_1); // Links innen hline (g, x1+2, y1, x2-1, col_1); // Oben außen hline (g, x1+2, y1+1, x2-2, col_1); // Oben innen vline (g, x2, y1+1, y2, col_3); // Rechts außen vline (g, x2-1, y1+2, y2, col_3); // Rechts innen hline (g, x1+1, y2, x2-2, col_3); // Unten außen hline (g, x1+2, y2-1, x2-2, col_3); // Unten innen release_bitmap(g); }
void AllegroGUIRenderer::drawPartialRoundedRect(int x, int y, int width, int height, int radius, partialRoundedRect part, const GUIColor& color) { adjustPoint(x, y); switch(part) { case prr_top: arc(target, x+radius, y+radius, itofix(64), itofix(128), radius, color); arc(target, x+width-radius-1, y+radius, itofix(0), itofix(64), radius, color); hline(target, x+radius, y, x+width-radius, color); vline(target, x, y+radius, y+height-1, color); vline(target, x+width-1, y+radius, y+height-1, color); break; case prr_bottom: arc(target, x+radius, y+height-radius-1, itofix(128), itofix(192), radius, color); arc(target, x+width-radius-1, y+height-radius-1, itofix(192), itofix(256), radius, color); hline(target, x+radius, y+height-1, x+width-radius-1, color); vline(target, x, y, y+height-radius-1, color); vline(target, x+width-1, y, y+height-radius-1, color); break; case prr_topRight: break; case prr_bottomRight: break; } }
void CursynthGui::drawText(const DisplayDetails* details, std::string text, bool active) { int y = details->y; if (details->label.size()) y += 1; // Clear area. move(y, details->x - 1); attron(COLOR_PAIR(BG_COLOR)); hline(' ', details->width + 2); move(y, details->x); attron(COLOR_PAIR(CONTROL_TEXT_COLOR)); hline(' ', details->width); // If active draw a bit different. if (active) { move(y, details->x - 1); attron(COLOR_PAIR(LOGO_COLOR)); hline('|', 1); move(y, details->x + details->width); hline('|', 1); attron(A_BOLD); } // Draw text. attron(COLOR_PAIR(CONTROL_TEXT_COLOR)); move(y, details->x); printw(gettext(text.c_str())); attroff(A_BOLD); attroff(COLOR_PAIR(CONTROL_TEXT_COLOR)); }
static void photon_container(BITMAP *bmp, int x, int y, int w, int h) { rect(bmp, x+1, y+1, x+w-2, y+h-2, container_black); hline(bmp, x, y, x+w-2, container_gray1); vline(bmp, x, y, y+h-2, container_gray1); hline(bmp, x+1, y+h-1, x+w-1, container_gray2); vline(bmp, x+w-1, y+1, y+h-1, container_gray2); }
void CursynthGui::clearPatches() { int selection_row = (PATCH_BROWSER_ROWS - 1) / 2; move(1 + selection_row, 83); hline(' ', PATCH_BROWSER_WIDTH); for (int i = 0; i < PATCH_BROWSER_ROWS; ++i) { move(1 + i, 94); hline(' ', PATCH_BROWSER_WIDTH); } }
void wline(const int r, const int c, const int length) { (void)move(r,c); if (length == 0) { (void)hline(ACS_HLINE,COLS); } else { (void)hline(ACS_HLINE,length); } (void)refresh(); }
static void photon_slider_cursor(BITMAP *bmp, int x, int y, int w, int h, int vert) { rect(bmp, x, y, x+w-2, y+h-2, container_black); hline(bmp, x+1, y+h-3, x+w-3, slider_gray4); vline(bmp, x+w-3, y+1, y+h-3, slider_gray4); hline(bmp, x+1, y+1, x+w-3, slider_white2); vline(bmp, x+1, y+1, y+h-3, slider_white2); rectgouraud(bmp, x+2, y+2, x+w-4, y+h-4, &slider_gray_range, vert); hline(bmp, x+1, y+h-1, x+w-1, slider_gray5); vline(bmp, x+w-1, y+1, y+h-1, slider_gray5); }
void Bitmap::drawRectOutline(const lost::math::Rect& inRect, const common::Color& inColor) { float minX = inRect.x; float minY = inRect.y; float maxX = inRect.maxX(); float maxY = inRect.maxY(); vline((uint32_t)minX, (uint32_t)minY, (uint32_t)maxY, inColor); vline((uint32_t)maxX, (uint32_t)minY, (uint32_t)maxY, inColor); hline((uint32_t)minY, (uint32_t)minX, (uint32_t)maxX, inColor); hline((uint32_t)maxY, (uint32_t)minX, (uint32_t)maxX, inColor); }
void draw_bevel(int l, int t, int r, int b, int tl, int m, int br) { int n; for (n = 0; n < BEVEL_SIZE; n++) { hline(screen, l + n, t + n, r - 1 - n, tl); putpixel(screen, r - n, t + n, m); vline(screen, l + n, t + 1 + n, b - 1 - n, tl); vline(screen, r - n, t + 1 + n, b - 1 - n, br); putpixel(screen, l + n, b - n, m); hline(screen, l + 1 + n, b - n, r - n, br); } }
void spot(struct fb* dst, int x0, int y0, int r, int cl) { int x, y, d; for(x=0, y=r, d=3-(r<<1); x<=y; x++) { hline(dst, -x+x0, y+y0, (x<<1)+1, cl); hline(dst, -x+x0,-y+y0, (x<<1)+1, cl); hline(dst, -y+x0, x+y0, (y<<1)+1, cl); hline(dst, -y+x0,-x+y0, (y<<1)+1, cl); if(d < 0) d = d+(x<<2)+6; else d = d+((x-(y--))<<2)+10; } }
void AllegroGUIRenderer::drawRoundedRect(int x, int y, int width, int height, int radius, const GUIColor& color) { adjustPoint(x, y); arc(target, x+radius, y+radius, itofix(64), itofix(128), radius, color); arc(target, x+width-radius-1, y+radius, itofix(0), itofix(64), radius, color); arc(target, x+radius, y+height-radius-1, itofix(128), itofix(192), radius, color); arc(target, x+width-radius-1, y+height-radius-1, itofix(192), itofix(256), radius, color); hline(target, x+radius, y, x+width-radius, color); hline(target, x+radius, y+height-1, x+width-radius-1, color); vline(target, x, y+radius, y+height-radius-1, color); vline(target, x+width-1, y+radius, y+height-radius-1, color); }
static void photon_do_draw_menu(int x, int y, int w, int h, int bar) { rect(screen, x, y, x+w-1, y+h-1, container_black); hline(screen, x+1, y+1, x+w-2, white); vline(screen, x+1, y+1, y+h-2, white); hline(screen, x+1, y+h-2, x+w-2, check_gray1); vline(screen, x+w-2, y+1, y+h-2, check_gray1); if (bar) rectgouraud(screen, x+2, y+2, x+w-3, y+h-3, &menu_gray_range, FALSE); else rectfill(screen, x+2, y+2, x+w-3, y+h-3, menu_gray_to); }
static void gtk_draw_menu_item(MENU *m, int x, int y, int w, int h, int bar, int sel) { BITMAP *bmp = gui_get_screen(); int fg, bg; int i, j; char buf[256], *tok; if (m->flags & D_DISABLED) { fg = nshadow; bg = normal; } else { fg = black; bg = (sel) ? highlight : normal; } rectfill(bmp, x+1, y+1, x+w-3, y+h-4, bg); if (ugetc(m->text)) { i = 0; j = ugetc(m->text); while ((j) && (j != '\t')) { i += usetc(buf+i, j); j = ugetc(m->text+i); } usetc(buf+i, 0); gui_textout_ex(bmp, buf, x+8, y+1, fg, bg, FALSE); if (j == '\t') { tok = m->text+i + uwidth(m->text+i); gui_textout_ex(bmp, tok, x+w-gui_strlen(tok)-10, y+1, fg, bg, FALSE); } if ((m->child) && (!bar)) draw_sprite(bmp, menu_arrow_bmp, x+w-12, y+(h-menu_arrow_bmp->h)/2); } else { hline(bmp, x+4, y+text_height(font)/2+2, x+w-4, nshadow); hline(bmp, x+4, y+text_height(font)/2+3, x+w-4, highlight); } if (m->flags & D_SELECTED) { line(bmp, x+1, y+text_height(font)/2+1, x+3, y+text_height(font)+1, fg); line(bmp, x+3, y+text_height(font)+1, x+6, y+2, fg); } }
int count(int k) { int i, j, c; for (c = 0, i = 1; i <= (n - k); i++) { for (j = 1; j <= (n - k); j++) { if (vline(i, j, k) && hline(i, j, k) && hline(i + k, j, k) && vline(i, j + k, k)) { c++; } } } return c; }
void tty_draw_hline (int y, int x, int ch, int len) { int x1; if (y < 0 || y >= LINES || x >= COLS) return; x1 = x; if (x < 0) { len += x; if (len <= 0) return; x = 0; } if ((chtype) ch == ACS_HLINE) ch = mc_tty_frm[MC_TTY_FRM_HORIZ]; move (y, x); hline (ch, len); move (y, x1); mc_curs_row = y; mc_curs_col = x1; }
static void draw_editarea() { move(window_y - INPUT_MAXLINE - 1, 0); hline('-', window_x); mvprintw(window_y - INPUT_MAXLINE, 0, "> "); clrtobot(); refresh(); }
void line(int x1, int y1, int x2, int y2, char c) { float k; if ((x1 == x2) && (y1 == y2)) { pixel(x1, y1, c); return; } if (x1 == x2) { vline(x1, MIN(y1, y2), MAX(y1, y2), c); return; } if (y1 == y2) { hline(MIN(x1, x2), MAX(x1, x2), y1, c); return; } k = (float)(y2 - y1) / (float)(x2 - x1); if ((k >= 0) && (k <= 1)) { bsubline_1(x1, y1, x2, y2, c); } else if (k > 1) { bsubline_2(x1, y1, x2, y2, c); } else if ((k < 0) && (k >= -1)) { bsubline_4(x1, y1, x2, y2, c); } else { bsubline_3(x1, y1, x2, y2, c); } }
void Graphics::drawHLine(ui::Color color, int x, int y, int w) { hline(m_bmp, m_dx+x, m_dy+y, m_dx+x+w-1, to_system(color)); }
static void tree_show_mini_info (WTree *tree, int tree_lines, int tree_cols) { Dlg_head *h = tree->widget.parent; int line; /* Show mini info */ if (tree->is_panel){ if (!show_mini_info) return; line = tree_lines+2; } else line = tree_lines+1; widget_move (&tree->widget, line, 1); hline (' ', tree_cols); widget_move (&tree->widget, line, 1); if (tree->searching){ /* Show search string */ attrset (TREE_NORMALC (h)); attrset (DLG_FOCUSC (h)); addch (PATH_SEP); addstr ((char *) name_trunc (tree->search_buffer, tree_cols-2)); addch (' '); attrset (DLG_FOCUSC (h)); } else { /* Show full name of selected directory */ addstr ((char *) name_trunc (tree->selected_ptr->name, tree_cols)); } }
/* Clears screen and draws status bar. */ void drawscreen(void) { clear(); xcolor_set(4); move(22, 0); hline(ACS_HLINE, 80); mvaddch(23, 1, '>'); mvaddch(23, 21, '<'); xcolor_set(5); mvaddstr(23, 23, _("Rank: %------- Score: %--- WPM: %-- CPS: %---- Misses: %-")); /* sets color to 2: NET, CHE need this */ drawstatus(0); switch (opt.net) { case H2H: mvaddstr(22, 70, "H2H"); break; case NET: mvaddstr(22, 70, "NET"); break; default: break; } if (opt.cheat) mvaddstr(22, 73, "CHE"); xcolor_set(5); }
void CursynthGui::drawPatchLoading(std::vector<std::string> patches, int selected_index) { int selection_row = (PATCH_BROWSER_ROWS - 1) / 2; move(1 + selection_row, 83); printw(gettext("Load Patch:")); int patch_index = selected_index - selection_row; int num_patches = patches.size(); for (int i = 0; i < PATCH_BROWSER_ROWS; ++i) { if (i % 2) attroff(COLOR_PAIR(PATCH_LOAD_COLOR)); else attron(COLOR_PAIR(PATCH_LOAD_COLOR)); move(1 + i, 94); hline(' ', PATCH_BROWSER_WIDTH); if (patch_index == selected_index) attron(A_BOLD); if (patch_index >= 0 && patch_index < num_patches) printw(patches[patch_index].c_str()); attroff(A_BOLD); patch_index++; } attroff(COLOR_PAIR(PATCH_LOAD_COLOR)); refresh(); }
static void drawbox(bool scrolling) { chtype bottom[XLENGTH + 1]; int n; if (hascolor) (void) attrset(COLOR_PAIR(PAIR_FRAMES)); MvAddCh(YBASE - 1, XBASE - 1, ACS_ULCORNER); hline(ACS_HLINE, XLENGTH); MvAddCh(YBASE - 1, XBASE + XLENGTH, ACS_URCORNER); MvAddCh(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER); if ((mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH)) != ERR) { for (n = 0; n < XLENGTH; n++) { if (!scrolling) bottom[n] &= ~A_COLOR; bottom[n] = ACS_HLINE | (bottom[n] & (A_ATTRIBUTES | A_COLOR)); } (void) mvaddchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH); } MvAddCh(YBASE + YDEPTH, XBASE + XLENGTH, ACS_LRCORNER); move(YBASE, XBASE - 1); vline(ACS_VLINE, YDEPTH); move(YBASE, XBASE + XLENGTH); vline(ACS_VLINE, YDEPTH); if (hascolor) (void) attrset(COLOR_PAIR(PAIR_OTHERS)); }
static void rectgouraud(BITMAP *bmp, int x1, int y1, int x2, int y2, GOURAUD_RANGE *range, int vert) { iRGB gamma; int x, y; if (vert) { for (x=x1; x<=x2; x++) { gamma.r = range->from.r + (range->to.r - range->from.r) * (x - x1) / (x2 - x1); gamma.g = range->from.g + (range->to.g - range->from.g) * (x - x1) / (x2 - x1); gamma.b = range->from.b + (range->to.b - range->from.b) * (x - x1) / (x2 - x1); vline(bmp, x, y1, y2, makecol(gamma.r, gamma.g, gamma.b)); } } else { for (y=y1; y<=y2; y++) { gamma.r = range->from.r + (range->to.r - range->from.r) * (y - y1) / (y2 - y1); gamma.g = range->from.g + (range->to.g - range->from.g) * (y - y1) / (y2 - y1); gamma.b = range->from.b + (range->to.b - range->from.b) * (y - y1) / (y2 - y1); hline(bmp, x1, y, x2, makecol(gamma.r, gamma.g, gamma.b)); } } }