void main(void) { int i=0; initgraph(&gd,&gm,""); while(!kbhit()) { if((i%2)==1) { setvisualpage(1); setactivepage(0); clearviewport(); face1->mood=0; drawface(); delay(1000); } else { setvisualpage(0); setactivepage(1); clearviewport(); face1->mood=1; drawface(); delay(300); } i++; } getch(); closegraph(); }
///////////////////FUNCION DESTRUIDO/////////////////////////////// void destruido() { int i=0; clearviewport(); for(i=0; i<100; i++) { setcolor(random(16)+1); settextstyle(1,0,10); outtextxy(50,0,"HAS SIDO INVADIDO"); outtextxy(50,100,"INVADIDO"); circle(xbuena,350-i,i); setactivepage(1-pagina); setvisualpage(pagina); pagina=1-pagina; delay(10); if(kbhit())break; } clearviewport(); setcolor(random(16)+1); settextstyle(1,0,3); outtextxy(50,0,"¨DESEAS CONTINUAR(S/N)?"); setactivepage(1-pagina); setvisualpage(pagina); pagina=1-pagina; continuar=getch(); if(continuar=='s'||continuar=='S') { tecla='p'; cuentanavebuena=3; } }
void runner() { clearviewport(); fstream f3; f3.open("product",ios::app|ios::nocreate); f3.seekg(0); if(f3.fail()) { cmpdtls(); staff(); //outtextxy(40,40,"This is a deault file"); } int val; int x,y,btn; int cnr; showmouse(); int whcnt=0; do { pro[whcnt].getdata(); rep: showmouse(); draw(); getmouse(btn,x,y); draw(); while(!(btn&1)==1) { getmouse(btn,x,y); if(cnr==0) draw(); cnr++; } while((btn&1)==1) getmouse(btn,x,y); f3.write((char*)&pro[whcnt],sizeof(product)); whcnt++; if(!((x>450&&x<500&&y>450&&y<460)||(x>550&&x<600&&y>450&&y<460))) goto rep; }while((x>450&&x<500&&y>450&&y<460)); f3.close(); clearviewport(); }
int main() { { TEXTO a(GOTHIC_FONT,VERT_DIR,10,"Turbo"); textoColor b(TRIPLEX_FONT,HORIZ_DIR,10,"Pascal",LIGHTBLUE); textoAmpliar c(SANS_SERIF_FONT,HORIZ_DIR,10,"Lenguaje", LIGHTRED,5,1,10,1); int i=23; TEXTO *p; textoColor *q; textoAmpliar *r; int *s; char s1[10]; int unidad=DETECT,modo; initgraph (&unidad,&modo,"c:\\bc\\bgi"); if (graphresult() != 0) { cout << "Error al tratar de pasar al modo grafico\n"; getch(); return 1; } p = &a; q = &b; r = &c; s = &i; p->escribir(); getch(); q->escribir(); getch(); r->escribir(); getch(); clearviewport(); settextstyle (DEFAULT_FONT,HORIZ_DIR,0); itoa (*s,s1,10); outtext(s1); getch(); clearviewport(); } // Aqui se destruyen los objetos en el siguiente orden: // 1) El destructor de la clase derivada // 2) El destructor de la clase base // Favor estudiar numeral 12.2 getch(); closegraph(); return 0; }
// Движение void MakeMove( int Ind ){ int n,Page; char Ch; float Angle = 3/DimAngle; Page=0; SetPages(Page,1-Page); while (!kbhit()){ for (n=0;n<4;n++) Rotate_Comp(TX[Ind][n],TY[Ind][n],TR[Ind][n]); clearviewport(); ShowLoops(Ind); ShowPlanes(Ind); ShowNamb(); Page=1-Page; SetPages(Page,1-Page); }; while(kbhit()) getch(); clearviewport(); };
void GraficoEspSecund ( void ) { int col; float far *apt; inicEsp2 = inicEsp1; AtivaJanelaGrafica ( GRAF2 ); clearviewport (); DesenhaEixos ( 25 , 235 , 10 , 110 , 0 , 0 , 50 , 12 ); ScalaEspSecund (); moveto ( 25 , 62 ); apt = inicEsp2; col = 25; for (; (*apt != FIM) && (apt < (inicEsp2 + NUMMAXPONTOS - 40)) ; apt += 40 , ++col) lineto ( col , 62 - *apt * 12 ); CapacVital2 = CapacidadeVital; CapacInspi2 = CapacidadeInspiratoria; VolResExpi2 = VolumeReservaExpiratorio; CVpercen2 = CVpercent; gprintf ( 5 , 160 , "Param. Teorico Calculado %%"); gprintf ( 5 , 170 , " CV %7.2f %6.2f %5d" , CVteorico , CapacVital2 , (int)(CVpercen2 + 0.5) ); gprintf ( 5 , 180 , " CI - %6.2f -" , CapacInspi2 ); gprintf ( 5 , 190 , " VRE - %6.2f -" , VolResExpi2 ); DesativaJanelaGrafica ( GRAF2 ); }
main() { int i, j = 0, gd = DETECT, gm; initgraph(&gd,&gm,"C:\\TURBOC3\\BGI"); settextstyle(DEFAULT_FONT,HORIZ_DIR,2); outtextxy(25,240,"Press any key to view the moving car"); getch(); setviewport(0,0,639,440,1); for( i = 0 ; i <= 420 ; i = i + 10, j++ ) { rectangle(50+i,275,150+i,400); rectangle(150+i,350,200+i,400); circle(75+i,410,10); circle(175+i,410,10); setcolor(j); delay(100); if( i == 420 ) break; clearviewport(); } getch(); closegraph(); return 0; }
/* * Redeseneaza zona din dreapta dupa ce utilizatorul a miscat sau a * modificat dreptunghiul in zona din stanga. */ void redraw_right_area() { int restidx, pi; set(3); setwritemode(COPY_PUT); setcolor(LIGHTBLUE); clearviewport(); for (int i = 0; i <= REF; i++) { if ((x[i] >= x1) && (x[i] <= x2) && (y[i] >= y1) && (y[i] <= y2)) { moveto(newX(x[i]), newY(y[i])); pi = i; restidx = i+1; i = REF+1; } } for (i = restidx; i <= REF; i++) { if ((x[i] >= x1) && (x[i] <= x2) && (y[i] >= y1) && (y[i] <= y2)) { if ((pi+1) == i) { lineto(newX(x[i]), newY(y[i])); } else { moveto(newX(x[i]), newY(y[i])); } pi = i; } } }
void staff() { clearviewport(); fstream f2; //remove("name of"); f2.open("name of",ios::app|ios::nocreate); if(f2.fail()) { fstream j; j.open("name of",ios::app); //cout<<"open failed"; int i,lt; cout<<"enter no of staffs( max 100 only..)\n"; cin>>lt; namepass stf[100]; for(i=0;i<lt;i++) { cout<<"enter staff "<<i+1<<"'s name\n"; cin>>stf[i].name; cout<<"enter staff"<<i+1<<"password\n"; cin>>stf[i].pass; j.write((char*)&stf[i],sizeof(namepass)); //j<<stf[i].name<<"\n"<<stf[i].pass<<"\n"; j.close(); } }
void main(void) { int gd = CUSTOM, gm = CUSTOM_MODE(1024,768); int page = 0; g_mousestate curState; g_mousestate oldState; int scrolling = 0; initgraph(&gd, &gm, ""); initParticles(particles); while(!anykeypressed()) { getmousestate(&curState); if((curState.buttons & MOUSE_LEFTBUTTON) == 0) { scrolling = 0; } else { if(scrolling == 0) { scrolling = 1; getmousestate(&oldState); } else { orgX -= -curState.x + oldState.x; orgY += -curState.y + oldState.y; oldState = curState; } } updateParticles(particles, particles2); setactivepage(1 - page); clearviewport(); drawParticles(particles); setvisualpage(1 - page); page = 1 - page; delay(4); } closegraph(); }
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 uno() { clearviewport(); setbkcolor(0); fillellipse(320,240,100,50); getch(); }
main() { int gd=DETECT, gm, x=10,y,i,j; char str[]="FONTS"; char *demo[]={ "DEFAULT FONT DEMO", "TRIPLEX FONT DEMO", "SMALL FONT DEMONSTRATION", "SANSSERIF FONT DEMO", "SCRIPT FONT DEMO" }; initgraph(&gd,&gm,"c:\\tc\\bgi"); setcolor(WHITE); for(i=0;i<=5;i++) { rectangle(0,20,639,479); settextstyle(0,0,1); outtextxy(150,10,demo[i]); y=30; for(j=1;j<=4;j++) { settextstyle(i,HORIZ_DIR,j); outtextxy(10,y,str); y+=(textheight(str)+10); } settextstyle(i,VERT_DIR,0); setusercharsize(2,1,3,2); outtextxy(10,y,str); getch(); clearviewport(); } getch(); }
//End of calcDimen() routine void drawText(char*txt) { resetWindow(); setcolor(WHITE); clearviewport(); outtextxy(2, 2, txt); }
void clearworkarea( void ) { struct viewporttype t; getviewsettings( &t ); setviewport( 1 + align, 25, 638 + align, 346, 0 ); clearviewport( ); setviewport( t.left, t.top, t.right, t.bottom, t.clip ); }
void resetWindow() { //Sets background color to GREEN setbkcolor (GREEN); //Sets drawing color to WHITE setcolor(WHITE); clearviewport(); }
int main() { TEXTO a,b,c,d; a.init (GOTHIC_FONT, VERT_DIR, 10, "Turbo"); b.init (TRIPLEX_FONT, HORIZ_DIR, 10, "Pascal"); c.init (SANS_SERIF_FONT, HORIZ_DIR, 10, "Lenguaje"); d.init (TRIPLEX_FONT, VERT_DIR, 10, "C++"); // Otras instrucciones int unidad=DETECT,modo; initgraph (&unidad,&modo,"c:\\bc\\bgi"); if (graphresult() != 0) { cout << "Error al tratar de pasar al modo grafico\n"; getch(); return 1; } settextstyle (a.tipoletra(), a.dir(), a.dimension() ); a.escribir(); getch(); clearviewport(); settextstyle (b.tipoletra(), b.dir(), b.dimension() ); b.escribir(); getch(); clearviewport(); settextstyle (c.tipoletra(), c.dir(), c.dimension() ); c.escribir(); getch(); clearviewport(); settextstyle (d.tipoletra(), d.dir(), d.dimension() ); d.escribir(); getch(); closegraph(); return 0; }
void interfaz(void) { // limpiar_pantalla(); setviewport(TITULO); clearviewport(); barra_titulo("=*CINEMATIC*="); setviewport(BARRA); clearviewport(); /*setcolor(AZUL+3); line(0,0,639,0); line(0,18,639,18); line(0,0,0,479); line(639,0,639,479); line(0,479,639,479); line(0,340,639,340);*/ }
void EscribirMenu(MOUSE &mouse) { mouse.Esconder(); clearviewport(); mouse.LimVert (100,200); mouse.LimHoriz (50,100); for (int i=0; i < 5; i++) outtextxy (100, i * 10 + 50,Menu[i]); mouse.Mostrar(); }
void textoColor::escribir() { int t; clearviewport(); t = getcolor(); setcolor(color); settextstyle(tipoletra(), dir(), dimension() ); outtext(s() ); setcolor (t); }
void textoAmpliar::escribir() { int t; clearviewport(); t = getcolor(); setcolor(col() ); settextstyle(tipoletra(), dir(), dimension() ); setusercharsize (m1x, m2x, m1y, m2y); outtext(s() ); setcolor (t); }
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 WorkArea::clear() { delete items; struct viewporttype vp; getviewsettings(&vp); setviewport(x1, y1, x2, y2, 1); items = new List(); clearviewport(); setviewport(vp.left, vp.top, vp.right, vp.bottom, vp.clip); }
void plD_eop_vga(PLStream *pls) { if (page_state == DIRTY) pause(pls); if (pls->graphx == GRAPHICS_MODE) { clearviewport(); } // _eopscreen(_GCLEARSCREEN); page_state = CLEAN; }
void inicio() { int i, j; inicializa(); clearviewport(); stars(); for(i=0; i<10; i++) for(j=0; j<10; j++) bar(170+j*30,100+i*30,200+j*30,130+i*30); getch(); }
void EscolheDroga (void) { register int delta_x, delta_y; char *pch, _i[5]; delta_x = PER_X (35); delta_y = 12 * CharH; CriaJanelaGrafica( M_PADRAO, (MAXX - delta_x)/2, (PER_Y(85) - delta_y /2), (MAXX + delta_x)/2, (PER_Y(85) + delta_y /2), 0, "" ); AtivaJanelaGrafica(M_PADRAO, 0); setcolor ( bea_color[14] ); clearviewport(); Moldura(); pch = "Qual a Droga ? "; delta_x = DELTA_X(50) - textwidth(pch)/2; delta_y = 8 * CharH; gprintf ( delta_x, delta_y, "4 - Outra"); delta_y = 6 * CharH; gprintf ( delta_x, delta_y, "3 - %s", Droga_P[2]); delta_y-= 2 + CharH; gprintf ( delta_x, delta_y, "2 - %s", Droga_P[1]); delta_y-= 2 + CharH; gprintf ( delta_x, delta_y, "1 - %s", Droga_P[0]); delta_y-= 2*CharH; gprintf ( delta_x, delta_y, pch ); do{ LEITURA('n', delta_x + textwidth(pch), delta_y, _i, 1, 1L, 4L); } while ( (*_i < '1') || (*_i > '4') ); DadProv.bits.droga = *_i - '1'; } /* End of EscolheDroga () */
void cinco(MOUSE &mouse) { int Boton,Vert,Horiz; mouse.LimVert (0,getmaxx() ); mouse.LimHoriz (0,getmaxy() ); mouse.Esconder(); clearviewport(); outtext("cinco"); mouse.Mostrar(); mouse.LibBotones(); while ( (Boton = mouse.Estado (&Vert, &Horiz) ) == 0 ) ; mouse.LibBotones(); }
void main() { inicializa(); stars(); eme(100, 150, 200, 250, 300, 100, 200, 250, 300, 5, LIGHTGRAY); getch(); clearviewport(); cruz(100,150,200,250,300,100,150,200,250,300,5, WHITE); stars(); getch(); clearviewport(); stars(); cinco(250,300,350,100,150,200,250,300,350,8, RED); getch(); clearviewport(); stars(); penta(200,300,400,350,250,120,200,300,9,BLUE); getch(); clearviewport(); stars(); batman(100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300, 320, 330, 340, 360, 380, 400, 420, 440, 460, 480, 500, 520, 540, 560, 50, 75, 100, 125, 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 2, YELLOW); getch(); }
/* this function draws the tutorial window each time it is called */ void tutorial_window(void) { int i,y; clearviewport(); /* back screen */ draw_3dbox(118,5,getmaxx()-175,getmaxy()-5,6); /* brown*/ draw_3dbox(130,20,getmaxx()-190,getmaxy()-20,15); /*white*/ setfillstyle(1,4); bar(120,7,129,getmaxy()-7); /* red */ setlinestyle(SOLID_LINE,1,2); for(i=0,y=44;i<16;i++,y+=26) /* the dots */ { setcolor(7); circle(140,y,4); setfillstyle(1,7); floodfill(140,y,7); } setcolor(3); /* spiral portion of the book */ for(i=0,y=40;i<16;i++,y+=26) { ellipse(128,y,140,340,14,11); ellipse(128,y+4,140,340,13,9); } setlinestyle(SOLID_LINE,1,3); setcolor(7); for(i=0;i<2;i++) { line(275,50-i,425+i,50-i); /* right page right corner */ line(425-i,50+i,425-i,140); line(165-i,353,165-i,430); /* right page left corner */ line(166+i,429-i,325,429-i); setlinestyle(SOLID_LINE,1,1); setcolor(8); /*for shade */ } undr_line(165,81,12,250,18,7); draw_3dbox(500,12,620,125,1); settextstyle(0,0,1); color_text(545,32,"Time",15); button(520,45,600,63,15,1); button(520,75,600,110,15,1); keyboard_lesson(); setcolor(4); circle(550,260,30); showMouse(); }
///////////////////////////FUNCION MENU//////////////////////////// void menu() { // int i=0;//opc=0; //fflush(stdin); clearviewport(); //pagina=1-pagina; setcolor(LIGHTBLUE); settextstyle(2,0,2); outtextxy(100,10,"ELIGE LAS OPCIONES:"); //numero de vidas de 1 a 5 do { clearviewport(); setcolor(LIGHTBLUE); settextstyle(1,0,2); outtextxy(100,50,"NUMERO DE VIDAS(1a5)Y PULSA ENTER:"); scanf("%d",&cuentanavebuena); } while(cuentanavebuena<0||cuentanavebuena>5); do { clearviewport(); setcolor(LIGHTRED); settextstyle(1,0,2); outtextxy(100,50,"ELIGE NIVEL DE DIFICULTAD(1a5)Y PULSA ENTER:"); scanf("%d",&mov); } while(mov<0||mov>5); mov*=mov; do { clearviewport(); setcolor(LIGHTGREEN); settextstyle(1,0,2); outtextxy(100,50,"ELIGE EL NUMERO DEESCUDOS(1a5)Y PULSA ENTER:"); scanf("%d",&topeescudo); } while(topeescudo<0||topeescudo>5); clearviewport(); }