int main(int argc, char *argv[]) { int color; for (color = 0; color < 8; color++) { textbackground(color); printf("This is color %d\r\n", color); printf("Press any key to continue.\n"); getchar(); } return 0; }
void salir(void) { textmode(C80); textbackground(BLACK); textcolor(LIGHTGRAY); clrscr(); puts("DPA Software. 1997"); puts("Jairo Alejandro Duarte Avenda¤o."); _setcursortype(_NORMALCURSOR); /* mostrar de nuevo el cursor */ nosound(); exit(0); }
void SetBackColor(int color) { if (color > 7 || color < 0) color = 7; #ifdef UNIX Background = colortable[color]; #else textbackground(backtable[color]); #endif }
void Refa_Zona_Afectata(int x,int y) { for(int i=y-4;i<=y+4;i++) for(int j=x-4;j<=x+4;j++) { gotoxy(j,i); textcolor(M[i][j].col); textbackground(M[i][j].bk_col); cprintf("%s",M[i][j].ch); } }
int select(void) { int sel; char ch; int quit; screen(); selectwindow(); _setcursortype(_NOCURSOR); sel=0; quit=0; while (!quit) { drawlist(sel); ch=getch(); if (ch==0) ch=getch(); switch (ch) { case 72: if (sel>=1) sel--; break; case 80: if (sel<nummods-1) sel++; break; case 73: if (sel>=6) sel-=6; else sel=0; break; case 81: if (sel<nummods-6) sel+=6; else sel=nummods-1; break; case 71: sel=0; break; case 79: sel=nummods-1; break; case 59: if (!isselected(sel+1)) toggle(sel); defaultmodule=isselected(sel+1); break; case 32: toggle(sel); break; case 13: quit=2; break; case 27: quit=1; break; } } _setcursortype(_NORMALCURSOR); window(1,1,80,25); textbackground(BLACK); textcolor(LIGHTGRAY); clrscr(); return quit-1; }
void desenhaMeioDesfazer(int ultimaJogada,int penultimaJogada) { int posicaoX=0,posicaoY=0; textbackground(YELLOW); textcolor(BLACK); posicaoDesenho(ultimaJogada,&posicaoX,&posicaoY); cputsxy(posicaoX,posicaoY,"-----"); posicaoY++; cputsxy(posicaoX,posicaoY,"| |"); posicaoY++; cputsxy(posicaoX,posicaoY,"-----"); posicaoDesenho(penultimaJogada,&posicaoX,&posicaoY); textbackground(BROWN); cputsxy(posicaoX,posicaoY,"-----"); posicaoY++; cputsxy(posicaoX,posicaoY,"|"); cputsxy(posicaoX+4,posicaoY,"|"); posicaoY++; cputsxy(posicaoX,posicaoY,"-----"); gotoxy(1,1); }
void errormessage(char far *message) { char scbuffer[800]; struct text_info inforec; int x1 = 10; int x2 = 10; int y1 = 20; int y2 = 23; if (strchr(message,13) != NULL) x2 += 2*strlen(message)/3 + 4; else x2 += strlen(message)+4; burp(); gettextinfo(&inforec); if (x2-x1 < 17) x2 = x1 + 17; gettext(1,y1,80,y2+1,scbuffer); textbackground(LIGHTGRAY); window(x1+1,y1+1,x2+1,y2+1); clrscr(); textbackground(BLACK); textcolor(LIGHTGRAY); window(x1,y1,x2,y2); clrscr(); window(x1,y1,x2+1,y2+1); textlineh(1,1,x2-x1+1); textlineh(y2-y1+1,1,x2-x1+1); textlinev(1,1,y2-y1+1,218,192); textlinev(x2-x1+1,1,y2-y1+1,191,217); window(1,1,80,25); gotoxy(x1 + (x2-x1)/2 - 5/2,y1); cprintf(" ERROR "); window(x1+2,y1+1,x2-2,y2-1); gotoxy(1,1); cprintf("%s",message); window(1,1,80,25); delay(1500); puttext(1,y1,80,y2+1,scbuffer); textattr(inforec.attribute); gotoxy(inforec.curx,inforec.cury); window(inforec.winleft,inforec.wintop,inforec.winright,inforec.winbottom); }
void main() { int k=1; clrscr(); textcolor(2); textbackground(0); while (k!=0) k=menue(); }
void mainframe() { char d; textbackground(BLACK); textcolor(RED); _setcursortype(0); clrscr(); cprintf(" �����������������������������������������������������������������������������ͻ"); cprintf(" � Master COMMAND.COM ver 1.0 �"); cprintf(" � �"); cprintf(" � It's a KVSM Product �"); cprintf(" � ----------------------------- �"); cprintf(" �����������������������������������������������������������������������������ͼ"); cprintf(" �����������������������������������������������������������������������������ͻ"); cprintf(" � �"); cprintf(" � �"); cprintf(" � 1. Change Commands �"); cprintf(" � �"); cprintf(" � 2. Help �"); cprintf(" � �"); cprintf(" � 3. About �"); cprintf(" � �"); cprintf(" � 4. Exit �"); cprintf(" � �"); cprintf(" � press any key(1,2,3,4) �"); cprintf(" �����������������������������������������������������������������������������ͼ"); cprintf(" �����������������������������������������������������������������������������ͻ"); cprintf(" � DEVELOPED BY �"); cprintf(" � �"); cprintf(" � MANOHAR SINGH NEGI �"); cprintf(" �����������������������������������������������������������������������������ͼ"); scanf("%c",&d); switch(d) { case '1': mani(); mainframe(); break; case '2': frame2(); break; case '3': frameabout(); break; case '4': exit(1); default: clrscr(); cprintf("Please enter the valid choice"); delay(300); mainframe(); } }
main() { textbackground(11); textcolor(9); clrscr(); int c; printf("DIGITE LA CANTIDAD DE DISCOS QUE DESEA MOVER: "); scanf("%d",&c); postes (c,1,2,3); getch(); }
void main () { int i,j; for (i=0;i<8;i++) { for (j=0;j<8;j++) scacchiera[i][j]=VUOTA; // La scacchiera è vuota. } // CARICAMENTO DELLE PEDINE i=0; for (j=0;j<8;j+=2) { scacchiera[i][j+1]=NERA; scacchiera[i+1][j]=NERA; scacchiera[i+2][j+1]=NERA; scacchiera[i+5][j]=BIANCA; scacchiera[i+6][j+1]=BIANCA; scacchiera[i+7][j]=BIANCA; } clrscr(); textcolor(BLACK); textbackground(WHITE); cprintf(" _DaMa <> Da*Me'_1.0 " ); textbackground(BLACK); do { stampaScacchiera(); scelta=visualizzaSchermo(); switch (scelta) { case 1:{ effettuaMossa(); break; } } } while (scelta !=0 && pedinaB !=0 && pedinaN !=0); cout << "\n* Fine del gioco *\n\a"; getch(); }
void office::of_beg() { int i, v; do{ textbackground(BLUE); textcolor(CYAN); _setcursortype(_NORMALCURSOR); clrscr(); for(i=0;i<10;++i) { box(1+7*i,1+2*i,4,4); delay(80); box(1+7*i,1+2*i,4,4,int(' ')); } box(74,22,4,4); gotoxy(25,2); textcolor(GREEN); cputs("WELCOME TO CREEPER OFFICE..."); gotoxy(6,6); textcolor(CYAN); cout<<"1. CALCULATOR"; gotoxy(6,12); cout<<"0. MAIN MENU"; gotoxy(6,8); cout<<"2. CREEPER FILE EXPERT "; gotoxy(6,10); cout<<"3. CALENDAR "; gotoxy(25,22); cout<<"ENTER THE CHOICE NUMBER : "; v=int(getche()-48); delay(100); if(v) { switch(v) { case 1: calc(); break; case 2: class File a; break; case 3: calendar(); break; default: gotoxy(55,22); cputs("INVALID ENTRY"); delay(1000); break; } } }while(v!=0); }
/* Call this before any call to linux conio - except the port functions ! */ void init_lconio (void) /* This is needed, because ncurses needs to be initialized */ { int x,y; initialized=1; initscr(); /* initialize curses screen -- modified by GLF to detect X Windows */ #ifdef XCURSES Xinitscr(1, fakelist); /* fake out argument list */ #else initscr(); #endif start_color(); oldattr=wattr_get(stdscr,&store_oldattr.attrs,&store_oldattr.color_pair,&store_oldattr.opts); nonl(); /* disable translation of CR to newline on input */ raw(); /* characters immediately available -- break not processed; like cbreak() but also passes INTR, QUIT, SUSP, and STOP chars */ noecho(); /* no echo of key input */ /* Removed from original linux-conio: if (!has_colors() & (color_warning>-1)) fprintf(stderr,"Attention: A color terminal may be required to run this application !\n"); */ /* GLF settings added to the original linux-conio initializations */ curs_set(0); /* turn off cursor */ /* cbreak(); */ /* characters immediately available -- break not processed */ clear(); /* clear screen */ timeout(0); /* non-blocking read -- if no input, return ERR */ conio_scr=newwin(0,0,0,0); keypad(conio_scr,TRUE); meta(conio_scr,TRUE); idlok(conio_scr,TRUE); scrollok(conio_scr,TRUE); /* Color initialization */ for (y=0;y<=7;y++) for (x=0;x<=7;x++) init_pair((8*y)+x+1, colortab(x), colortab(y)); txtattr=wattr_get(conio_scr,&store_txtattr.attrs,&store_txtattr.color_pair,&store_txtattr.opts); bgc=0; textcolor(7); textbackground(0); }
void piscaVerde(){ textbackground(BLACK); Beep(600,500); printxy(32, 1, " "); printxy(32, 2, " "); printxy(32, 3, " "); printxy(32, 4, " "); printxy(32, 5, " "); printxy(32, 6, " "); printxy(32, 7, " "); wait(0.5); verde(); }
void quitgame(int Conf/*1--Confirm, 0--no confirm*/) { char ch; if(Conf) { window(20,9,60,15); textbackground(LIGHTGRAY); textcolor(RED); clrscr(); gotoxy(1,6); cprintf("-----------------------------------------"); gotoxy(1,1); cprintf("-------------- Exit Game ----------------"); textcolor(MAGENTA); gotoxy(16,2); cprintf("Warning!"); gotoxy(2,3); cprintf("Do you really want to quit this game?"); textcolor(LIGHTGREEN); while(1) { gotoxy(15,4); cprintf("OK? [Y/N] "); ch=getch(); if(ch=='Y'||ch=='y') break; else if(ch=='N'||ch=='n') { JudgeKey(); return; } } } window(1,1,80,25); textbackground(BLACK); textcolor(LIGHTGRAY); clrscr(); exit(0); }
char *newFile(void) { static char fname[FNSIZE]; int c; gotoxy(1,25); textcolor(mcolor); textbackground(mbgrd); clreol(); fname[0] = FNSIZE; cprintf("Enter file: "); return cgets(fname); }
void piscaMagentaClaro(){ textbackground(BLACK); Beep(2000,500); printxy(48, 15, " "); printxy(48, 16, " "); printxy(48, 17, " "); printxy(48, 18, " "); printxy(48, 19, " "); printxy(48, 20, " "); printxy(48, 21, " "); wait(0.5); magentaClaro(); }
void piscaVerdeClaro(){ textbackground(BLACK); Beep(1800,500); printxy(32, 15, " "); printxy(32, 16, " "); printxy(32, 17, " "); printxy(32, 18, " "); printxy(32, 19, " "); printxy(32, 20, " "); printxy(32, 21, " "); wait(0.5); verdeClaro(); }
void piscaAzulClaro(){ textbackground(BLACK); Beep(1600,500); printxy(16, 15, " "); printxy(16, 16, " "); printxy(16, 17, " "); printxy(16, 18, " "); printxy(16, 19, " "); printxy(16, 20, " "); printxy(16, 21, " "); wait(0.5); azulClaro(); }
void piscaMarrom(){ textbackground(BLACK); Beep(1400,500); printxy(48, 8, " "); printxy(48, 9, " "); printxy(48, 10, " "); printxy(48, 11, " "); printxy(48, 12, " "); printxy(48, 13, " "); printxy(48, 14, " "); wait(0.5); marrom(); }
void MenuBar::drawGrund() { //Den tomma gråa raden char tom[COLUMNS+1]; for(int i = 0; i < getWidth(); i++) tom[i] = ' '; tom[getWidth()] = '\0'; textbackground(MBARBG); gotoxy(getTop(),getLeft()); cputs(tom); drawUpdate(); //Knapparna och activa menyer }
void piscaVermelho(){ textbackground(BLACK); Beep(1000,500); printxy(16, 8, " "); printxy(16, 9, " "); printxy(16, 10, " "); printxy(16, 11, " "); printxy(16, 12, " "); printxy(16, 13, " "); printxy(16, 14, " "); wait(0.5); vermelho(); }
void piscaAmarelo(){ textbackground(BLACK); Beep(800,500); printxy(48, 1, " "); printxy(48, 2, " "); printxy(48, 3, " "); printxy(48, 4, " "); printxy(48, 5, " "); printxy(48, 6, " "); printxy(48, 7, " "); wait(0.5); amarelo(); }
void piscaAzul(){ textbackground(BLACK); Beep(400,500); printxy(16, 1, " "); printxy(16, 2, " "); printxy(16, 3, " "); printxy(16, 4, " "); printxy(16, 5, " "); printxy(16, 6, " "); printxy(16, 7, " "); wait(0.5); azul(); }
void piscaBranco(){ textbackground(BLACK); Beep(1200,500); printxy(32, 8, " "); printxy(32, 9, " "); printxy(32, 10, " "); printxy(32, 11, " "); printxy(32, 12, " "); printxy(32, 13, " "); printxy(32, 14, " "); wait(0.5); branco(); }
void welcome() { int i,j; clrscr(); textcolor(4); gotoxy(25,5); cprintf("Welcome to PC to PC chat"); gotoxy(22,6); cprintf("Program for RS232 communication"); textcolor(2); gotoxy(21,7); cprintf("By Shreeharsha Perla & Veena Pai"); sleep(1); window(10,9,70,23); textbackground(1); clrscr(); textcolor(3); window(1,1,80,25); for(i=0;i<=60;i++) { gotoxy(10+i,3); putch(205); //Í gotoxy(10+i,23); putch(205); //Í } for(j=0;j<=20;j++) { gotoxy(10,3+j); putch(186); //º gotoxy(70,3+j); putch(186); //º } gotoxy(10,3); putch(201); //É gotoxy(70,3);putch(187); //» gotoxy(10,23); putch(200); //È gotoxy(70,23);putch(188); //¼ sleep(1); gotoxy(15,10); // cprintf("Enter: Send"); // cprintf("\nEsc : Exit"); // cprintf("\nF1 : Help"); window(12,11,68,22); cprintf("To start chating, connect serial port COM1" " of both the computers by a 3-wire link. " "For more details about connections and serial" " port, Visit our website: " "\n http://eharsha.tk "); gotoxy(3,12); cprintf("Press any key to start...."); window(1,1,80,25); getch(); }
void mani() { int ch=1; char original[9],newcom[9]; textbackground(RED); textcolor(WHITE); _setcursortype(1); loop: while(ch) { fp=fopen("C:\\windows\\command.com","rb+"); clrscr(); if(fp==NULL) { fp=fopen("c:\\command.com","rb+"); clrscr(); if(fp==NULL) { fp=fopen("c:\\windows\\system32\\command.com","rb+"); clrscr(); if(fp==NULL) { puts("Error opening file"); puts("\nPress any key to exit"); getche(); exit(0); } } } gotoxy(100,200); printf("\n\n\nEnter the Dos command to change ?( For ex. DIR )\n\n"); scanf("%s",original); gotoxy(100,210); printf("\nEnter the new command name of the same length \n\n"); scanf("%s",newcom); if(strlen(original)!=strlen(newcom)) { printf("\tEnter an alternative of same length\n"); delay(100); goto loop; } strupr(original); strupr(newcom); findreplace(original,newcom); fclose(fp); gotoxy(200,300); printf("\nDo you want to change other commands ?\n\nPress 1 or 0 \n"); scanf("%d",&ch); } }
void Popup_menu(int pos1) //defaultvalue { int row=1, i; window(15,12,36,17); textbackground(0); clrscr(); for ( i = 0; i<Popup_Size1+2; i++ ) { textbackground(7); gotoxy(1,row*i+1); textcolor(0); cprintf(Popup_list[i]); } for ( i = 0; i<Popup_Size1; i++ ) { if ( pos1==i) textbackground(2); else textbackground(7); gotoxy(3,row*i+2); textcolor(4); cprintf(popup_list1[i]); textcolor(0); cprintf(popup_list2[i]); } }
void glo(void) // selected: green light only { int period; //prompt to enter time interval printf("\n\nPlease enter a desired integer time period for green light:"); fflush(stdin); scanf("%d", &period); //clear screen; start showing animation system("cls"); textcolor(2); textbackground(0); for(int time=period; time>0; time--){ for(int frame=0; frame<18; frame++){ for(int i=0; i<16; i++){ for(int j=0; j<16; j++){ if (gm[frame][i][j] == 1){ cprintf("*"); } else if(gm[frame][i][j] == 't'){ cprintf("%d", time); } else{ cprintf(" "); } } printf("\n"); } Sleep(56); system("cls"); } }; //return to default color textcolor(7); textbackground(0); }
static int conio_end_graphics(caca_display_t *dp) { _wscroll = 1; textcolor((enum COLORS)WHITE); textbackground((enum COLORS)BLACK); gotoxy(caca_get_canvas_width(dp->cv), caca_get_canvas_height(dp->cv)); cputs("\r\n"); _setcursortype(_NORMALCURSOR); free(dp->drv.p->screen); free(dp->drv.p); return 0; }