int objectlibrary::checkall() { int loop,temp,clicked; mouse(); mousestatus(clicked); if(clicked) { for(loop=0;loop<numbuttons;loop++) { if(buttons[loop]->mouseover()) { if(SHOWMOUSE) hidemouse(); buttons[loop]->click(); if(SHOWMOUSE) showmouse(); return buttons[loop]->getindex(); } } for(loop=0;loop<numtables;loop++) { if(tables[loop]->mouseover()) { if(SHOWMOUSE) hidemouse(); tables[loop]->click(); if(SHOWMOUSE) showmouse(); return -1; } } } return -1; }
void fillp() { int a[2]; int x,y,button; setcolor(c); hidemouse(); rectangle(42,62,598,458); mousecall(); mousepos(button,x,y); if(button==1) { setfillstyle(cc,c); a[0]=x; a[1]=y; static int v1=0,v2=0; hidemouse(); floodfill(a[0],a[1],c); if(v1!=a[0] || v2!=a[1]) { fout<<"floodfill("<<a[0]<<','<<a[1]<<','<<c<<");\n"; v1=a[0],v2=a[1]; } mousecall(); } }
static void mousehandler() { for (;;) { MOUEVENTINFO m; unsigned short status; clock_t start; #if 0 if (MouGetDevStatus((PUSHORT) &status, mousenum) != 0 || (status & (MOUSE_UNSUPPORTED_MODE | MOUSE_DISABLED)) ) { hidemouse(); (void) MouClose(mousenum); DosExit(EXIT_THREAD, 0); } #endif status = MOU_WAIT; MouReadEventQue((PMOUEVENTINFO) &m, (PUSHORT) &status, mousenum); /* * If we don't get the control semaphore immediately, * we do nothing. Delayed responses to mouse button * presses could be confusing. */ #if 0 start = clock(); #endif if (DosSemRequest(control, SEM_IMMEDIATE_RETURN) != 0) continue; #if 0 if (clock() != start) { (void) fprintf(stderr, "mouse thread: %d\n", __LINE__); DosSemClear(control); continue; } #endif /* * Start of critical section. */ if (++keystrokes >= PSVKEYS) lastevent = clock(); if (State == NORMAL && (m.fs & (MOUSE_BN1_DOWN | MOUSE_BN2_DOWN | MOUSE_BN3_DOWN))) { hidemouse(); mouseclick(m.row, m.col); showmouse(); } /* * End of critical section. */ DosSemClear(control); } }
void product:: display() { char txt1[20],txt2[20],txt3[20]; hidemouse(); clearviewport(); outtextxy(25,40," "); outtextxy(25,40,"name of product"); outtextxy(25,50,name); outtextxy(25,60," "); outtextxy(25,60,"price"); sprintf(txt1,"%g",price); outtextxy(25,70,txt1); outtextxy(25,80," "); outtextxy(25,80,"quantity"); sprintf(txt2,"%d",qty); outtextxy(25,90,txt2); sprintf(txt3,"%d",prno); outtextxy(25,100," "); outtextxy(25,100,"product no"); outtextxy(25,110,txt3); showmouse(); }
void brush(int x1,int y1) { int x2,y2; int button=0; setcolor(c); mousecall(); mousepos(button,x2,y2); do { if(button==1) { static int v1=0,v2=0,v3=0,v4=0; hidemouse(); line(x1,y1,x2,y2); if(v1!=x1 || v2!=y1 || v3!=y2 || v4!=x2) { fout<<"line("<<x1<<','<<y1<<','<<x2<<','<<y2<<");\n"; v1=x1,v2=y1,v3=y2,v4=x2; } mousecall(); x1=x2,y1=y2; } else mousepos(button,x1,y1); mousepos(button,x2,y2); }while(x2>43 && x2<597 && y2>63 && y2<457); }
static JSBool js_conio_hidemouse(JSContext *cx, uintN argc, jsval *arglist) { jsrefcount rc; rc=JS_SUSPENDREQUEST(cx); JS_SET_RVAL(cx, arglist, INT_TO_JSVAL(hidemouse())); JS_RESUMEREQUEST(cx, rc); return(JS_TRUE); }
void data1() { hidemouse(); Panel modify; modify.init(6,56,getmaxx()-5,getmaxy()-7,THIN,IN);; modify.show(); modify.shape("MODIFY"); Panel move; move.init(220,120,525,455,OUT,THIN); move.show( ); move.shape("MODIFY"); showmouse(); settextstyle(0,0,1); ifstream fio("pro//product",ios::app); ofstream file("pro//temp",ios::out); fio.seekg(0); product s1,s2; int rno; char found='f'; char confirm='y'; outtextxy(240,202,"enter prno to append"); boxx(rno,240,222); while(!fio.eof()) { fio.read((char*)&s1,sizeof(product)); if(s1.no()==rno) { found='t'; if(confirm=='y') { s1.display(); s2.appm(s1); file.write((char*)&s2,sizeof(product));} confirm='n'; } else file.write((char*)&s1,sizeof(product)); } if(found=='f') outtextxy(240,242,"record not found"); fio.close(); file.close(); remove("pro//product"); rename("pro//temp","pro//product"); fio.close(); file.close(); }
void product:: getdata() { char txt1[20],txt2[20],txt3[20]; hidemouse(); clearviewport(); gotoxy(5,1); cout<<"enter name of product\n"; gotoxy(5,2); gets(name); gotoxy(5,1); cout<<" "; gotoxy(1,2); cout<<" "; outtextxy(25,40," "); outtextxy(25,40,"name of product"); outtextxy(25,50,name); gotoxy(5,1); cout<<"enter price\n "; cin>>price; gotoxy(5,1); cout<<" "; gotoxy(1,2); cout<<" "; outtextxy(25,60," "); outtextxy(25,60,"price"); sprintf(txt1,"%g",price); outtextxy(25,70,txt1); gotoxy(5,1); cout<<"enter quantity present in stock\n "; cin>>qty; gotoxy(5,1); cout<<" "; gotoxy(1,2); cout<<" "; outtextxy(25,80," "); outtextxy(25,80,"quantity"); sprintf(txt2,"%d",qty); outtextxy(25,90,txt2); gotoxy(5,1); cout<<"enter product no\n "; cin>>prno; gotoxy(5,1); cout<<" "; gotoxy(1,2); cout<<" "; sprintf(txt3,"%d",prno); outtextxy(25,100," "); outtextxy(25,100,"product no"); outtextxy(25,110,txt3); //progno=prog_id; // ert sgrgrseerh }
void main(){char c=' ';int x,y,b=0; window(1,1,80,25); textbackground(0); textcolor(15); clrscr(); gotoxy(1,1);cout << 'Q'; if(ifmouse())showmouse(); while(c!='q') { while(!kbhit()) { readmouse(); b=mouseb;x=(mousex>>3)+1;y=(mousey>>3)+1; if(mouseb!=0) { gotoxy(x,y); switch(b) { case 1:hidemouse(); cout<<c; showmouse(); break; case 2:gettext(x,y,x,y,&c);break; } gotoxy(x,y); } if(b==1&&x==1) { if(y==1){c='q';break;} } } if(c!='q')c=getch(); hidemouse(); cout << c; showmouse(); } }
int main () { clrscr(); loading(); //getch(); //psswd_disp(); //curnt_fn=set_psswd; while (!(detect ()==0x2d00 ));//&& (modifiers & ALT)) );//detecting the mose and keyboard action hidemouse ();//assiging the flag interrupt for hiding the mouse //closing all the files fcloseall(); //cleardevice(); return 0; }
void drawgrid() { if(selectedwindow()==3) { hidemouse(); //setcolor(15); int x1,x2,y1,y2; for(int loopx=0;loopx<maxx;loopx++) { for(int loopy=0;loopy<maxy;loopy++) { x1=windows[3].x1+4+(loopx*size); x2=x1+size-1; y1=windows[3].y1+17+(loopy*size); y2=y1+size-1; if(graph[loopx][loopy]==16) { setfillstyle(1,7); bar(x1,y1,x2,y2); setcolor(8); line(x1,y1,x2,y2); line(x1,y2,x2,y1); } else { setfillstyle(1,graph[loopx][loopy]); bar(x1,y1,x2,y2); } setcolor(0); rectangle(x1,y1,x2+1,y2+1); } } thumb(); showmouse(); } }
void drawpixel(int x, int y) { hidemouse(); int x1=windows[3].x1+4+(x*size); int x2=x1+size-1; int y1=windows[3].y1+17+(y*size); int y2=y1+size-1; setfillstyle(1,graph[x][y]); if(graph[x][y]==16) { setfillstyle(1,7); bar(x1,y1,x2,y2); setcolor(8); line(x1,y1,x2,y2); line(x1,y2,x2,y1); } else bar(x1,y1,x2,y2); setcolor(0); rectangle(x1,y1,x2+1,y2+1); thumb(); showmouse(); }
void eraser() { bar(15); setfillstyle(SOLID_FILL,15); int button,x,y; mousepos(button,x,y); if(button==1 && x>48&&x<592&&y<452&&y>68) { static int v1=0,v2=0; hidemouse(); pieslice(x, y, 0, 360, 6); if(v1!=x ||v2!=y) { fout<<"pieslice("<<x<<','<<y<<','<<"0,360,6);\n"; v1=x,v2=y; } mousecall(); } }
void menu(int mx,int my) { outline(mx,my); int x,y,cl; settextstyle(DEFAULT_FONT,0,3); setcolor(BLUE); callmouse(); outtextxy((mx/2)-80,50,"MENU"); outtextxy((mx/2)-220,150,"1.PLAY"); outtextxy((mx/2)-220,250,"2.HIGH SCORES"); outtextxy((mx/2)-220,350,"3.EXIT"); char ch; while(1) { altermouse(x,y,cl); if(cl==1) { if(x>(mx/2)-220 && x<(mx/2)-80 && y>150 && y<200) { game(mx,my); } else if(x>(mx/2)-220 && x<(mx/2)+90 && y>250 && y<300) { displayscores(mx,my); } else if(x>(mx/2)-220 && x<(mx/2)-80 && y>350 && y<400) { hidemouse(); closegraph(); exit(0); } } } }
/* * inchar() - get a character from the keyboard. * * Timeout not implemented yet for OS/2. */ int inchar(long mstimeout) { for (;;) { KBDKEYINFO k; bool_t mstatus, psvstatus; flush_output(); mstatus = (usemouse && State == NORMAL); psvstatus = (keystrokes >= PSVKEYS); /* * We don't have to give control to any other thread * if neither of these conditions is true. */ if (mstatus || psvstatus) { #ifndef NOMOUSE if (mstatus) showmouse(); #endif if (psvstatus && DosSemWait(psvsema, SEM_IMMEDIATE_RETURN) == ERROR_SEM_TIMEOUT) { /* * If psvsema is set, clear it. */ DosSemClear(psvsema); } DosSemClear(control); } /* * Start of non-critical section. * * Wait for character from keyboard. */ KbdCharIn((PKBDKEYINFO) &k, IO_WAIT, 0); /* * End of non-critical section. */ if (mstatus || psvstatus) { DosSemRequest(control, SEM_INDEFINITE_WAIT); #ifndef NOMOUSE if (mstatus) hidemouse(); #endif } if (++keystrokes >= PSVKEYS) lastevent = clock(); /* * Now deal with the keypress information. */ if ((unsigned char) k.chChar == (unsigned char) 0xe0) { /* * It's (probably) a function key. */ if (k.chScan == 0x53) /* * It's the delete key. */ return State == NORMAL ? 'x' : '\b'; /* else */ if (State == NORMAL) { /* * Assume it must be a function key. */ switch (k.chScan) { case 0x3b: return(K_HELP); /* F1 key */ case 0x47: return(K_HOME); /* home key */ case 0x48: return(K_UARROW); /* up arrow key */ case 0x49: return(K_PGUP); /* page up key */ case 0x4b: return(K_LARROW); /* left arrow key */ case 0x4d: return(K_RARROW); /* right arrow key */ case 0x4f: return(K_END); /* end key */ case 0x50: return(K_DARROW); /* down arrow key */ case 0x51: return(K_PGDOWN)); /* page down key */ case 0x52: return(K_INSERT); /* insert key */ default: /* just ignore it ... */ continue; } /* * If we aren't in command mode, 0xe0 * is a perfectly legitimate * character, & we can't really tell * whether or not it's supposed to be * a function key, so we just have to * return it as is. */ } } return (unsigned char) k.chChar; } }
void grf_eraserect(int grf, int x1, int y1, int x2, int y2, int color) { struct grf_softc *gp; u_long *start, *end, longsperline, longspertline, x, y; register u_long *ptr, c; register int len, i; u_char *sc; struct font *f; if (grf == -1) { return; } grf_flush(grf); gp = &grf_Softc[grf]; f = &gp->g_term.font; hidemouse(gp); if (x1 < 0) { x1 = 0; } if (y1 < 0) { y1 = 0; } if (x2 > gp->g_term.numtcols - 1) { x2 = gp->g_term.numtcols - 1; } if (y2 > gp->g_term.numtrows - 1) { y2 = gp->g_term.numtrows - 1; } #ifdef INVERSE c = ~0L; #else c = 0; /* BG 04/15/94 - I'm not sure what the above * is supposed */ /* to be, but it's 0x7fffffff, which isn't quite right. */ #endif /* INVERSE */ longsperline = gp->g_display.rowbytes / sizeof(long); longspertline = longsperline * gp->g_term.font.height; ptr = (u_long *) (gp->g_display.fbbase); start = ptr + y1 * longspertline; end = ptr + (y2 + 1) * longspertline; if (x1 == 0 && x2 == gp->g_term.numtcols - 1) { len = end - start; ptr = start; for (i = len / 8; i > 0; i--) { UNROLL(8, *ptr++ = c); } UNROLL(len % 8, *ptr++ = c); } else { if (gp->g_display.psize == 1) { if (gp->g_term.font.width == 8) { while (start < end) { sc = (u_char *) start + x1; for (x = x1; x <= x2; x++) { *sc++ = c; } start += longsperline; } } else { for (y = y1; y <= y2; y++) { for (x = x1; x <= x2; x++) { grf_writestr(grf, 1, " ", x, y, T_NORMAL, color); } } } } else { for (y = y1; y <= y2; y++) { for (x = x1; x <= x2; x++) { grf_writestr(grf, 1, " ", x, y, T_NORMAL, color); } } } } showmouse(gp); }
void run(double *accum, int *cur_loc, mem_array mem) { int prg_counter = 0, // mem cell location of the command being executed next_loc = 0, // mem cell location of the next command to be executed run_flag = CONTINUE; // flag for when to stop the execution of the // user's program. Values are CONTINUE, STOP // and RUN_ERR char cmdtrans[80]; // an English translation of the current command enum speed run_speed; // the run mode hidemouse(); // if they want to run if(get_speed(&run_speed) == CONTINUE) { // set up screen for running put_accum(accum); clear_monitor(); clear_keyboard(); clear_keys(); /* user's program loop */ do { // execute at the next location prg_counter = next_loc; // THF patch, was +2 put_prg_counter(prg_counter + 1); put_instruct(mem[prg_counter]); bright_cell(prg_counter, mem[prg_counter]); // case statement for run mode switch(run_speed) { case SLOW: delay(SLOW_DELAY_TIME); break; case FAST: delay(FAST_DELAY_TIME); } /// if there is a command in the cell if(mem[prg_counter].entry_type == CMD) { // command type case statement switch(mem[prg_counter].cmd_type) { case LDC: run_flag = ldc(accum, mem, cmdtrans, prg_counter, &next_loc); break; case ADC: run_flag = adc(accum, mem, cmdtrans, prg_counter, &next_loc); break; case LDA: run_flag = lda(accum, mem, cmdtrans, prg_counter, &next_loc); break; case STA: run_flag = sta(accum, mem, cmdtrans, prg_counter, &next_loc); break; case ADD: run_flag = add(accum, mem, cmdtrans, prg_counter, &next_loc); break; case SUB: run_flag = sub(accum, mem, cmdtrans, prg_counter, &next_loc); break; case MUL: run_flag = mul(accum, mem, cmdtrans, prg_counter, &next_loc); break; case DIV: run_flag = div(accum, mem, cmdtrans, prg_counter, &next_loc); break; case INP: run_flag = inp(mem, cmdtrans, prg_counter, &next_loc); break; case OUT: run_flag = out(mem, cmdtrans, prg_counter, &next_loc); break; case BPA: run_flag = bpa(accum, mem, cmdtrans, prg_counter, &next_loc); break; case BNA: run_flag = bna(accum, mem, cmdtrans, prg_counter, &next_loc); break; case BZA: run_flag = bza(accum, mem, cmdtrans, prg_counter, &next_loc); break; case BRU: run_flag = bru(mem, cmdtrans, prg_counter, &next_loc); break; case STP: run_flag = stp(cmdtrans, prg_counter, &next_loc); if(run_speed == CYCLE) { display_cmdtrans(cmdtrans); } break; default: run_err_message("ERROR: Unkown command at this location."); run_flag = RUN_ERR; break; } } else { run_err_message("ERROR: Unkown command at this location."); run_flag = RUN_ERR; } // check to see if the user wants to stop if(kbhit()) { if(getch() == EscKey) { run_flag = STOP; } } if((run_speed == CYCLE) && (run_flag == CONTINUE)) { run_flag = display_cmdtrans(cmdtrans); } dim_cell(prg_counter, mem[prg_counter]); } while((run_flag == CONTINUE) && (mem[prg_counter].cmd_type != STP)); // clear the registers when program is done clear_instruct(); clear_prg_counter(); } showmouse(); if(run_flag == RUN_ERR) { *cur_loc = prg_counter; } display_keys(); }
void Mouse(char ch) { if(ch=='o') bar(0); else if(ch=='n') { setfillstyle(SOLID_FILL,15); hidemouse(); bar(42,62,598,458); mousecall(); setcolor(c); bar(c); } int cl,x5,y5,tool; int x1=604,y1=70,z=616,w=84; setfillstyle(cc,c); bar(12,290,27,310); //fillp show bar do { if(ch=='n') { ch='k'; if(tool==4) fout<<"setfillstyle(SOLID_FILL,"<<c<<");\n"; else if(tool==1) fout<<"setfillstyle(SOLID_FILL,15);\n"; else if(tool==6) fout<<"setfillstyle("<<cc<<','<<c<<");\n"; fout<<"setcolor("<<c<<");\n"; fout<<"rectangle(42,62,598,458);\n"; } mousecall(); x1=604,y1=70,z=616,w=84; for(int i=0;i<8;i++,y1+=25,w+=25) { mousepos(cl,x5,y5); if(x5>=x1&&x5<=z&&y5>=y1&&y5<=w) if(cl==1) { static int v=1; if(v!=c) { fout<<"setfillstyle(SOLID_FILL,"<<c<<");\n"; fout<<"setcolor("<<c<<");\n"; fout<<"rectangle(42,62,598,458);\n"; v=c; } c=i; setfillstyle(cc,c); bar(12,290,27,310); setfillstyle(SOLID_FILL,c); } } x1=621,y1=70,z=633,w=84; for( i=8;i<16;i++,y1+=25,w+=25) { mousepos(cl,x5,y5); if(x5>=x1&&x5<=z&&y5>=y1&&y5<=w) if(cl==1) { static int v=0; c=i; setfillstyle(cc,c); bar(12,290,27,310); setfillstyle(SOLID_FILL,c); if(v!=c) { fout<<"setfillstyle(SOLID_FILL,"<<c<<");\n"; fout<<"setcolor("<<c<<");\n"; fout<<"rectangle(42,62,598,458);\n"; v=c; } } } x1=605,y1=320,z=637,w=457; for(i=7;i<11;i++,y1+=25,w+=25) { mousepos(cl,x5,y5); if(x5>=x1&&x5<=z&&y5>=y1&&y5<=w) if(cl==1) { static int v=0; cc=i; setfillstyle(cc,c); bar(12,290,27,310); if(v!=cc) { fout<<"setfillstyle("<<cc<<','<<c<<");\n"; v=cc; } } } x1=5,y1=320,z=37,w=457; for(i=2;i<7;i++,y1+=25,w+=25) { mousepos(cl,x5,y5); if(x5>=x1&&x5<=z&&y5>=y1&&y5<=w) if(cl==1) { static int v=0; cc=i; setfillstyle(cc,c); bar(12,290,27,310); if(v!=cc) { fout<<"setfillstyle("<<cc<<','<<c<<");\n"; v=cc; } } } bar(c); delay(100); mousepos(cl,x5,y5); if(x5>=621&&x5<=635&&y5>=3&&y5<=16) //changes made !!! { if(cl==1) { hidemouse(); break; } } mousepos(cl,x5,y5); int gg=0; gg=help_bar(gg); while(x5>=24&&x5<=36&&y5>=70&&y5<=84) { mousepos(cl,x5,y5); setcolor(0); settextstyle(SMALL_FONT,0,4); outtextxy(45,464,"RECTANGLE "); gg=1; if(cl==1) { tool=0; } } gg=help_bar(gg); static int er=1; mousepos(cl,x5,y5); while(x5>=6&&x5<=18&&y5>=145&&y5<=159) { mousepos(cl,x5,y5); setcolor(0); settextstyle(SMALL_FONT,0,4); outtextxy(45,464,"ERASER "); gg=1; if(cl==1 && er==1) { tool=1; bar(15); fout<<"setfillstyle(SOLID_FILL,15);\n"; fout<<"setcolor(15);\n"; er=2; } } if(tool!=1) { bar(c); er=1; } gg=help_bar(gg); mousepos(cl,x5,y5); while(x5>=6&&x5<=18&&y5>=70&&y5<=84) { mousepos(cl,x5,y5); setcolor(0); settextstyle(SMALL_FONT,0,4); outtextxy(45,464,"LINE"); gg=1; if(cl==1) { tool=2; } } gg=help_bar(gg); mousepos(cl,x5,y5); while(x5>=6&&x5<=18&&y5>=90&&y5<=109) { mousepos(cl,x5,y5); setcolor(0); settextstyle(SMALL_FONT,0,4); outtextxy(45,464,"CIRCLE"); gg=1; if(cl==1) { tool=3; } } gg=help_bar(gg); mousepos(cl,x5,y5); while(x5>=24&&x5<=36&&y5>=120&&y5<=134) { mousepos(cl,x5,y5); setcolor(0); settextstyle(SMALL_FONT,0,4); outtextxy(45,464,"BUCKET"); gg=1; if(cl==1) { if(cc!=1) { fout<<"setfillstyle(SOLID_FILL,"<<c<<");\n"; cc=1; } tool=4; } } gg=help_bar(gg); mousepos(cl,x5,y5); while(x5>=24&&x5<=36&&y5>=90&&y5<=109) { mousepos(cl,x5,y5); setcolor(0); settextstyle(SMALL_FONT,0,4); outtextxy(45,464,"BRUSH "); gg=1; if(cl==1) { tool=5; } } gg=help_bar(gg); mousepos(cl,x5,y5); while(x5>=6&&x5<=18&&y5>=120&&y5<=134) { mousepos(cl,x5,y5); setcolor(0); settextstyle(SMALL_FONT,0,4); gg=1; outtextxy(45,464,"FILLER"); if(cl==1) { tool=6; } } gg=help_bar(gg); mousepos(cl,x5,y5); static int v=0; if(x5>39 && x5<78 && y5>=42 && y5<=55) //save { if(cl==1) { char f[20]; hidemouse(); SBMP("temp.bmp"); if(op('b')) { strcpy(f,s); if(!strchr(f,'.')) strcat(f,".bmp"); int check; check=rename("temp.bmp",f); if(check==-1) { remove(f); rename("temp.bmp",f); } } if(v==0) { if(op('c')) { v=1; if(!strchr(s,'.')) strcat(s,".cpp"); strcpy(::f,s); } else if(bmp("temp.bmp",0,0)) {} else bmp(f,0,0); } if(bmp(f,0,0)); else bmp("temp.bmp",0,0); mousecall(); } } mousepos(cl,x5,y5); if(x5>=10 && x5<39 && y5>=42 && y5<=55) //open { if(cl==1) { hidemouse(); SBMP("temp.bmp"); if(op('o')) { if(!strchr(s,'.')) strcat(s,".bmp"); if(bmp(s,0,0)) { settextstyle(2,0,7); cleardevice(); setcolor(RED); outtextxy(200,220," SUCH FILE DOES NOT EXIST"); outtextxy(200,280,"PRESS ENTER TO CONTINUE:"); getch(); bmp("temp.bmp",0,0); } } else bmp("temp.bmp",0,0); mousecall(); } } mousepos(cl,x5,y5); if(x5>78 && x5<111 && y5>=42 && y5<=55) //new { if(cl==1) { v=0; main('n'); } } mousepos(cl,x5,y5); if(x5>111 && x5<174 && y5>=42 && y5<=55) //password change { if(cl==1) { hidemouse(); SBMP("temp.bmp"); if(op('p')) { ofstream fout("pass.txt"); char t[20]; for(int m=0;s[m]!='\0';m++) { t[m]=s[m]-27; } t[m]='\0'; fout<<t; fout.close(); } bmp("temp.bmp",0,0); mousecall(); } } mousepos(cl,x5,y5); if(x5>174 && x5<217 && y5>=42 && y5<=55) //help { if(cl==1) { hidemouse(); SBMP("temp.bmp"); help(); bmp("temp.bmp",0,0); mousecall(); } } while(x5>43 && x5<597 && y5>63 && y5<457) { mousepos(cl,x5,y5); mousecall(); if(cl==1 && x5>43 && x5<597 && y5>63 && y5<457 ) { double a,b,p,x1,y1,x2,y2; static int v1=0,v2=0,v3=0,v4=0; double r; switch(tool) { case 0://rectangle mousecall(); x1=x5; y1=y5; delay(500); restrict(43,597,63,457); mousepos(cl,x5,y5); x2=x5,y2=y5; setcolor(c); hidemouse(); rectangle(x1,y1,x2,y2); if(v1!=x1 || v2!=x2 || v3!=y1 || v4!=y2) { fout<<"rectangle("<<x1<<','<<y1<<','<<x2<<','<<y2<<");\n"; v1=x1,v2=x2,v3=y1,v4=y2; } mousecall(); restrict(0,640,0,480); break; case 1:eraser(); break; case 2://line(); mousecall(); x1=x5; y1=y5; delay(500); restrict(43,597,63,457); mousepos(cl,x5,y5); x2=x5,y2=y5; setcolor(c); hidemouse(); line(x1,y1,x2,y2); if(v1!=x1 || v2!=x2 || v3!=y1 || v4!=y2) { fout<<"line("<<x1<<','<<y1<<','<<x2<<','<<y2<<");\n"; v1=x1,v2=x2,v3=y1,v4=y2; } mousecall(); restrict(0,640,0,480); break; case 3://circle(); mousecall(); x1=x5; y1=y5; delay(500); restrict(43,597,63,457); mousepos(cl,x5,y5); x2=x5,y2=y5; a=(x1-x2)*(x1-x2),b=(y1-y2)*(y1-y2); p=a+b; r=SQRT(p); setcolor(c); int c1=x1+r,c2=x1-r,c3=y1+r,c4=y1-r; hidemouse(); circle(x1,y1,r); if(v1!=x1 || v2!=y1) { fout<<"circle("<<x1<<','<<y1<<','<<r<<");\n"; v1=x1,v2=y1; } if(c1>597 || c2<43 || c3>457 || c4<63) SCREEN(); mousecall(); restrict(0,640,0,480); break; case 4:bucket(); break; case 5:brush(x5,y5); break; case 6:fillp(); break; default:brush(x5,y5); } } } }while(1); }
pullmenu() { char scr[1200],s[80]; int x,y,i,goon,c; goon=1; onwait(); x=wherex(); y=wherey(); hidemouse(); gettext(13,5,61,16,scr); puttext(13,5,61,16,USERED); showmouse(); while(goon) { gotoxy(23,12); cprintf(" "); gotoxy(23,12); textcolor(LIGHTCYAN); inputlocal(s,30); strupr(s); switch(s[0]) { case 'Q': goon=0; break; case '1': gotoxy(15,14); textcolor(LIGHTBLUE); cprintf("Old Name: "); textcolor(LIGHTGRAY); cprintf("%s",user.name); gotoxy(15,15); textcolor(LIGHTGREEN); cprintf("New Name: "); inputlocal(s,40); gotoxy(15,14); cprintf(" "); gotoxy(15,15); cprintf(" "); if(s[0]!=0 || stricmp(user.name,s)==0) { if(!ver_user(s)) strcpy(user.name,s); } break; case '2': gotoxy(15,14); textcolor(LIGHTBLUE); cprintf("Old User SL: "); textcolor(LIGHTGRAY); cprintf("%d",user.sl); gotoxy(15,15); textcolor(LIGHTGREEN); cprintf("New User SL: "); textcolor(LIGHTGRAY); inputlocal(s,20); gotoxy(15,14); cprintf(" "); gotoxy(15,15); cprintf(" "); i=atoi(s); if(i >= 0 || i <= 255) user.sl=i; break; case '3': gotoxy(15,14); textcolor(LIGHTBLUE); cprintf("Old File SL: "); textcolor(LIGHTGRAY); cprintf("%d",user.filesl); gotoxy(15,15); textcolor(LIGHTGREEN); cprintf("New File SL: "); textcolor(LIGHTGRAY); inputlocal(s,20); gotoxy(15,14); cprintf(" "); gotoxy(15,15); cprintf(" "); i=atoi(s); if(i >= 0 || i <= 255) user.filesl=i; break; case '4': gotoxy(15,14); textcolor(LIGHTBLUE); cprintf("Old Note: "); textcolor(LIGHTGRAY); cprintf("\"%s\"",user.note); gotoxy(15,15); textcolor(LIGHTGREEN); cprintf("New Note: "); textcolor(LIGHTGRAY); inputlocal(s,40); gotoxy(15,14); cprintf(" "); gotoxy(15,15); cprintf(" "); if(s[0]!=0) strcpy(user.note,s); break; case '5': gotoxy(15,14); textcolor(LIGHTBLUE); cprintf("Old Time: "); textcolor(LIGHTGRAY); cprintf("%d",print_time()/60); gotoxy(15,15); textcolor(LIGHTGREEN); cprintf("New Time: "); textcolor(LIGHTGRAY); inputlocal(s,20); gotoxy(15,14); cprintf(" "); gotoxy(15,15); cprintf(" "); if(s[0]!=0) { user.timeall=atoi(s)*60; timeleft=atoi(s)*60; } break; case '6': i=1; gotoxy(15,14); textcolor(LIGHTBLUE); cprintf("User Flags: "); while(i) { goon=0; while(goon < 10) { gotoxy(27+goon,14); if(user.flags[goon]) { textcolor(LIGHTRED); cprintf("%d",goon); } else { textcolor(LIGHTGRAY); cprintf("%d",goon); } goon++; } gotoxy(15,15); textcolor(LIGHTGREEN); cprintf("Enter flag to toggle [Q/Quit]: "); do { c=getch(); if(c=='Q' || c=='q') { gotoxy(15,14); cprintf(" "); gotoxy(15,15); cprintf(" "); i=0; } } while(c < '0' || c > '10'); gotoxy(37,15); cprintf("%c",c); if(user.flags[c-48]) user.flags[c-48]=0; else user.flags[c-48]=1; gotoxy(37,15); cprintf(" "); } break; case '7': gotoxy(15,14); textcolor(LIGHTBLUE); cprintf("Old Password: "******"%s",user.pass); gotoxy(15,15); textcolor(LIGHTGREEN); cprintf("New Password: "******" "); gotoxy(15,15); cprintf(" "); if(s[0]!=0) strcpy(user.pass,s); break; case '8': gotoxy(15,14); textcolor(LIGHTBLUE); cprintf("Old Filepoints: "); textcolor(LIGHTGRAY); cprintf("%d",user.filepoints); gotoxy(15,15); textcolor(LIGHTGREEN); cprintf("New Filepoints: "); inputlocal(s,40); gotoxy(15,14); cprintf(" "); gotoxy(15,15); cprintf(" "); if(s[0]!=0) user.filepoints=atoi(s); break; } } writeuser(); puttext(13,5,61,16,scr); gotoxy(x,y); offwait(); }
void grf_writestr(int grf, int len, unsigned char *s, int x, int y, int attr, int color) { struct grf_softc *gp; register u_char *uc, ul; /* u_char *sc, *ssc; */ u_char bitmask[20]; register int i; int fbrowbytes, reverse; int width, height, numleft; struct font *f; u_long buf[32 * 16]; int startx, endx, longstartx, longendx; int numlongs, sh, startchar, endchar; register u_long *bufp; register int j; if (grf == -1) { return; } gp = &grf_Softc[grf]; if (x < 0) { i = -x; x += i; s += i; len -= i; } i = gp->g_term.numtcols - x; if (len > i) { len = i; } if (len <= 0 || y < 0 || y >= gp->g_term.numtrows) { return; } hidemouse(gp); #ifdef UNDERLINE if (attr & T_BOLD) { #else if (attr & T_BOLD || attr & T_UNDERLINE) { #endif /* UNDERLINE */ f = &gp->g_term.bold; } else { f = &gp->g_term.font; } width = f->width; height = f->height; reverse = (!(attr & T_REVERSE) != !(attr & T_SELECTED)); #ifdef INVERSE reverse = !reverse; #endif /* INVERSE */ fbrowbytes = gp->g_display.rowbytes; startx = x * width; endx = (x + len) * width; y *= height; bitmask[0] = (1 << width) - 1; for (i = 1; i < height; i++) { bitmask[i] = bitmask[0]; } ul = 255 & bitmask[0]; /* * Blit the beginning and end independently from middle */ longstartx = (startx + 31) & ~31; longendx = endx & ~31; numleft = (longstartx - startx + width - 1) / width; if (numleft > len) { numleft = len; } for (i = 0; i < numleft; i++) { uc = f->data + height * s[i]; #ifdef UNDERLINE if (attr & T_UNDERLINE) *(uc + height - 1) ^= ul; #endif /* UNDERLINE */ blitWrite(gp, startx + i * width, y, width, height, uc, bitmask, reverse); #ifdef UNDERLINE if (attr & T_UNDERLINE) *(uc + height - 1) ^= ul; #endif /* UNDERLINE */ } /* * Blit middle in one chunk */ numlongs = (longendx - longstartx) / 32; if (numlongs <= 0) { goto nomiddle; /* Yes boys, LAK did a goto */ } for (i = numlongs * height - 1; i >= 0; i--) { buf[i] = 0; } for (j = 0; j < numlongs; j++) { startchar = (j * 32 + longstartx - startx) / width; endchar = (j * 32 + 31 + longstartx - startx) / width; sh = 32 - width - startchar * width + longstartx - startx + j * 32; for (i = startchar; i <= endchar; i++, sh -= width) { #ifdef UNDERLINE if (s[i] == ' ' && !(attr & T_UNDERLINE)) { #else if (s[i] == ' ') { #endif /* UNDERLINE */ continue; } uc = f->data + height * s[i]; #ifdef UNDERLINE if (attr & T_UNDERLINE) *(uc + height - 1) ^= ul; #endif /* UNDERLINE */ bufp = &buf[j]; if (sh < 0) { sh = -sh; UNROLL(height, *bufp |= *uc++ >> sh; bufp += numlongs); sh = -sh; } else { UNROLL(height, *bufp |= *uc++ << sh; bufp += numlongs); } #ifdef UNDERLINE if (attr & T_UNDERLINE) *(uc - 1) ^= ul; #endif /* UNDERLINE */ } } blitWriteAligned(gp, longstartx, y, numlongs * 32, height, buf, reverse); nomiddle: if (longendx >= longstartx) { numleft = (endx - longendx + width - 1) / width; if (numleft > len) { numleft = len; } for (i = len - numleft; i < len; i++) { uc = f->data + height * s[i]; #ifdef UNDERLINE if (attr & T_UNDERLINE) *(uc + height - 1) ^= ul; #endif /* UNDERLINE */ blitWrite(gp, startx + i * width, y, width, height, uc, bitmask, reverse); #ifdef UNDERLINE if (attr & T_UNDERLINE) *(uc + height - 1) ^= ul; #endif /* UNDERLINE */ } } showmouse(gp); }
int keyhit() { /* function 1 returns 0 until a key is pressed */ //int wxmax=80;//user setting max x value //int wymax=25;//user setting max y value //float xunit;//horixontal unit(scaling ratio) step =1 for 80,25 //float yunit;//vertical unit(scaling ratio) step =1 for 80,25 //int flag;// flag for local purpose /* function 0 returns the key that is waiting */ /* function 1 returns 0 until a key is pressed */ if (_bios_keybrd(_KEYBRD_READY) != 0) //while (!kbhit () ) { //do{ key = _bios_keybrd(_KEYBRD_READ); /* use function 2 to determine if shift keys were used */ /*modifiers = _bios_keybrd(_KEYBRD_SHIFTSTATUS); if (modifiers) { printf("["); if (modifiers & RIGHT) printf("RIGHT"); if (modifiers & LEFT) printf("LEFT"); if (modifiers & CTRL) printf("CTRL"); if (modifiers & ALT) printf("ALT"); printf("]"); } // print out the character read printf("%#02x\n", key); */ hidemouse(); switch (key)//detecting the function keys { case 0x3b00://Fn1 key is pressed help(); //getch(); break; case 0x3c00://Fn2 key is pressed curnt_fn=billmain; tbldisp(); break; case 0x3d00://Fn3 key is pressed curnt_fn=menu_cur; menu(); break; case 0x3e00: curnt_fn=get_psswd;//assigning the current function as the main of the billing part psswd_disp();//initial display for the table of the bill break; case 0x4400: //psswd_disp();//initial display for the table of the bill //curnt_fn=get_psswd;//assigning the current function as the main of the billing part psswd_main(); break; } curnt_fn(key); //}while (detect ()!=0x11b); } //getch(); showmouse(); return key; }
void grf_scrollup(int grf, int x1, int y1, int x2, int y2, int numlines, int color) { struct grf_softc *gp; register u_long *ptr1, *ptr2; u_long longspertline /* , numlongs */ ; /* MBW -- added the following line for the efficiency fix below */ u_long rowbytes, bytecount; long rowcnt; if (grf == -1) { return; } grf_flush(grf); gp = &grf_Softc[grf]; if (x1 < 0) { x1 = 0; } if (y1 < 0) { y1 = 0; } if (x2 > gp->g_term.numtcols - 1) { x2 = gp->g_term.numtcols - 1; } if (y2 > gp->g_term.numtrows - 1) { y2 = gp->g_term.numtrows - 1; } if (numlines >= y2 - y1 + 1) { grf_eraserect(grf, x1, y1, x2, y2, color); return; } hidemouse(gp); longspertline = gp->g_display.rowbytes * gp->g_term.font.height / sizeof(long); /* MBW -- divide by 4 because it will be added to a (long*) */ rowbytes = gp->g_display.rowbytes / sizeof(long); if (numlines > 0) { if (x1 == 0 && x2 == gp->g_term.numtcols - 1) { rowcnt = (y2 - y1 + 1 - numlines) * gp->g_term.font.height; if (rowcnt < 0) { grf_eraserect(grf, x1, y1, x2, y2, color); showmouse(gp); return; } bytecount = (7 + gp->g_term.font.width * gp->g_term.numtcols) >> 3; ptr1 = (u_long *) (gp->g_display.fbbase) + y1 * longspertline; ptr2 = ptr1 + longspertline * numlines; while (rowcnt--) { bcopy(ptr2, ptr1, bytecount); ptr1 += rowbytes; ptr2 += rowbytes; } } else { /* XXX */ }
void game(int mx,int my) { cleardevice(); int x,y,cl=0,i,j,ctr=0,points=0,lives=3,dt=100; int *ycoord,*bomby; int delaytime[20]; int randomcolor; int *xcoord,*bombx,numctr=0,playtime=0; int nob=0,bombctr=0,temp,selbomb; callmouse(); setlimits(23,mx-23,23,my-23); delay(100); // ASSIGN THE SPEED for(i=0;i<10;i++){delaytime[i]=i+10;} // ALOCATE MEMORY FOR COORDINATES if((ycoord=(int *)malloc(10))==NULL||(xcoord=(int *)malloc(10))==NULL||(bomby=(int *)malloc(10))==NULL||(bombx=(int *)malloc(10))==NULL) { cout<<"\nMEMORY ALLOCATION ERROR!"; getch(); exit(0); } randomize(); outline(mx,my); //THE GAME BEGINS int start=clock(),end; for(i=0;i<lives;i++) { setcolor(WHITE); circle((mx-200)+(i*20),my-10,6); setfillstyle(SOLID_FILL,RED); floodfill((mx-200)+(i*20),my-10,WHITE); } for(;;) { // ASSIGN COORDINATES TO BOMBS selbomb=random(10); if( (selbomb%7)==0 && nob<=3) { *(bombx+bombctr)=50; *(bomby+bombctr)=random(my-100)+50; bombctr++; nob++; } // ASSIGN COORDINATES TO BUBLES if(numctr<3) { *(xcoord+ctr)=48; *(ycoord+ctr)=random(my-100)+48; numctr++; ctr++; } // DROP THE BOMBS for(i=0;i<nob;i++) { setcolor(WHITE); circle(*(bombx+i),*(bomby+i),22); } // CREATE BUBLES for(i=0;i<numctr;i++) { randomcolor=random(5)+1; setcolor(randomcolor); circle(*(xcoord+i),*(ycoord+i),20); } // MOUSE altermouse(x,y,cl); delay(dt); // CHECK WHAT HAPPENED WITH BUBLES temp=numctr; for(i=0;i<temp;i++) { // CHECK IF BUBLES WERE HIT if(x < *(xcoord+i)+20 && x > *(xcoord+i)-20 && y< *(ycoord+i)+20 && y>*(ycoord+i)-20) { points+=10; numctr--; ctr=i; cleardevice(); outline(mx,my); for(j=0;j<lives;j++) { setcolor(WHITE); circle((mx-200)+(j*20),my-10,6); setfillstyle(SOLID_FILL,RED); floodfill((mx-200)+(j*20),my-10,WHITE); } } // DE-CREATE THE BUBLES setcolor(BLACK); circle(*(xcoord+i),*(ycoord+i),20); // LET THE BUBLES MOVE *(xcoord+i)+=delaytime[i]; // CHECK FOR PLAYER'S DEATH if(xcoord[i]>=mx-48) { numctr--; lives--; if(lives==0){goto again;} for(j=0;j<lives+1;j++) { setcolor(BLUE); circle((mx-200)+(i*20),my-10,6); setfillstyle(SOLID_FILL,BLUE); floodfill((mx-200)+(j*20),my-10,BLUE); } for(j=0;j<lives;j++) { setcolor(WHITE); circle((mx-200)+(j*20),my-10,6); setfillstyle(SOLID_FILL,RED); floodfill((mx-200)+(j*20),my-10,WHITE); } ctr=i; } } // CHECK WHAT HAPPENED WITH THE BOMB temp=nob; for(i=0;i<temp;i++) { // CHECK FOR PLAYERS DEATH AND THE END OF GAME if(x < *(bombx+i)+22 && x > *(bombx+i)-22 && y< *(bomby+i)+22 && y>*(bomby+i)-22) { goto again; } // DE-CREATE THE BOMBS setcolor(BLACK); circle(*(bombx+i),*(bomby+i),22); // LET THE BOMBS MOVE *(bombx+i)+=delaytime[i]; // CHECK FOR THE BOMBS DEATH if(*(bombx+i)>=mx-45) { bombctr=i; nob--; *(bombx+bombctr)=48; *(bomby+bombctr)=random(my-100)+50; nob++; } } end=clock(); playtime=ceill((end-start)/CLK_TCK); if(playtime>10) { dt-=10; start=clock(); } } // THIS IS THE END : again: cleardevice(); outline(mx,my); endgame(points,mx,my); readscore(points); hidemouse(); delete ycoord,xcoord; menu(mx,my); }
void sscreen( ) { cleardevice( ); Panel main_bar,Screen,tool; main_bar.init(0,0,getmaxx( ),getmaxy( ),IN,THIN); main_bar.show(); char*txt="SUPER MARKET SUPERVISOR..ver-2r"; { int x1=0; int y1=0; int x2=getmaxx( ); int y2=getmaxy( ); int x=x1+13; int y=y1-1; setcolor(8); rectangle(x1+4,y1+4,x2-5,y+41); rectangle(x1+4,y+48,x2-5,y2-5); setcolor(15); rectangle(x1+5,y+6,x2-4,y+42); rectangle(x1+5,y+ 49,x2-4,y2-4); setfillstyle(1,9); bar(x1+8,y1+8,x2-8,y+38); settextstyle(8,0,4); setcolor(0); outtextxy(x,y,txt); outtextxy(x+1,y,txt); setcolor(14); outtextxy(x+2,y-1,txt); outtextxy(x+3,y-1,txt); outtextxy(x+4,y-1,txt); } tool.init(0,35,getmaxx(),55,IN,THIN); tool.show(); Button Add,Delete,Modify,Search,About,Exit; Add.init(6,35,"Add ",FLAT); Add.show( ); Delete.init(111,35,"Delete ",FLAT); Delete.show( ); Modify.init(221,35,"Modify ",FLAT); Modify.show( ); Search.init(331,35,"Search ",FLAT); Search.show( ); About.init(441,35,"About ",FLAT,0,0,7,1); About.show( ); Exit.init(551,35,"Exit ",FLAT); Exit.show( ); Screen.init(5,53,632,467,IN,THICK,0); Screen.show( ); setcolor(8); rectangle(4,53,633,471); setcolor(15); rectangle(5,54,634,472); initmouse(); while(1) { showmouse(); int ch=selc(Add,Delete,Modify,Search,About,Exit,30,32,50,31,48,18); hidemouse(); wrkng(ch); } }
void help() { setfillstyle(SOLID_FILL,0); bar(129,59,501,401); setfillstyle(SOLID_FILL,8); bar(130,60,500,400); setfillstyle(SOLID_FILL,7); bar(140,70,490,390); setfillstyle(SOLID_FILL,1); bar(140,60,490,75); setcolor(YELLOW); outtextxy(145,58,"/"); outtextxy(146,58,"/"); outtextxy(147,60,"/"); outtextxy(148,60,"/"); outtextxy(149,62,"/"); outtextxy(150,62,"/"); settextstyle(SMALL_FONT,0,6); setcolor(4); outtextxy(255,58,"HELP INDEX"); setfillstyle(SOLID_FILL,15); int x=160,y=90,z=470,w=370; bar(x,y,z,w); setcolor(8); line(x,y,z,y); line(x,y,x,w); setcolor(0); line(x+1,y+1,z-1,y+1); line(x+1,y+1,x+1,w-1); settextstyle(SMALL_FONT,0,4); // corner_button(460,380); setcolor(0); int key=0; int k1; char butt[4][10]={"UP ","DN ","LT ","RT "}; char hp[5][10]={"^","v","<",">"}; while(key<4) { switch(key) { case 0: k1=160; break; case 1: k1=160+70; break; case 2: k1=160+140; break; case 3: k1=160+210; break; } setcolor(0); corner_button(k1+33,380); outtextxy(k1,373,butt[key]); outtextxy(k1+32,373,hp[key]); outtextxy(k1+33,373,hp[key]); key++; } lines=17; //no. of lines in window SCROLLER(); hidemouse(); mousecall(); }