вот еще один пример. работа напрямую через впамять
| Код | #include <conio.h> #include <dos.h>
int pgraph[2][6] = {{179,191,192,196,217,218},{186,187,200,205,188,201}}; char far *tm_addr = (char far*) MK_FP(0xB800, 0x0000); enum type {Single, Double};
void _print(int x, int y, int symbol, int text_color, int bg_color) { char far *vptr = tm_addr + ((x-1)+(y-1)*80)*2; char attr = text_color + (bg_color << 4); *(vptr+1) = attr; *vptr = symbol; }
void drawWnd(int x1, int y1, int x2, int y2, type a, int col, int bg) { int n; _print(x1,y1,pgraph[a][5],col,bg); for (n=x1+1; n<x2; n++) { _print(n,y1,pgraph[a][3],col,bg); _print(n,y2,pgraph[a][3],col,bg); } _print(x2,y1,pgraph[a][1],col,bg); for (n=y1+1; n<y2; n++) { _print(x1,n,pgraph[a][0],col,bg); _print(x2,n,pgraph[a][0],col,bg); } _print(x1,y2,pgraph[a][2],col,bg); _print(x2,y2,pgraph[a][4],col,bg); }
int main() { _setcursortype(_NOCURSOR); textmode(C80); clrscr(); drawWnd(1,1,80,25,Double, 1,0); getch(); return 0; }
| |