/////////////////////////////////////////////////////////////////////////// ///// Nombre: Cgraph.cpp /// ///// Modulo: Perteneciente a Catalogo.C /// //// Descripci¢n: Confecciona la pantalla de inicio /// //// /// //// Autor: Jos‚ David Guill‚n Dominguez /// //// Fecha: (Unknow) /// //// /// //// Compilador Borland C++ 3.0 ( Creaci¢n original en Turbo C 2.0 ) /// /////////////////////////////////////////////////////////////////////////// #include <graphics.h> // Libreria de Funciones Graficas #include <dos.h> extern struct boton { int left; int up; int right; int down; }; void fundido_al_negro(void); void pon_paleta(char *punt, int bandera); void DibujaPantalla(void); void DibujaOjo(void); void DibujaInfo(void); void DibujaSalir(void); void ImprimeBoton (int left, int up, int right, int down, int cdf, int cs1, int cs2); void ImprimeBoton2 (int fill, int cdf, int cs1, int cs2, struct boton parm); //void ImprimeBoton2 (struct boton parm); /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* Esta Funci¢n imprimira los botones, pasandole como argumentos la estructura boton, que define: Izquierda ( left ) "int" Arriba ( up ) Derecha ( right ) "int" Abajo ( down ) Color de Fondo ( cdf ) "int" Color Sombra 1 ( cs1 ) "int" Color Sombra 2 ( cs2 ) "int" Constante de Lugar: ( cdl ) "int" 1 Sombra en ESI 2 Sombra en EII 3 Sombra en ESD 4 Sombra en EID GENERADOR DE BOTONES INVENCION DEL FUENTE EXCLUSIVA DE Jos‚ David Guill‚n */ void ImprimeBoton (int left, int up, int right, int down, int cdf, int cs1, int cs2) { int puntos[14]; puntos[0] = left+1; puntos[1] = up-1; puntos[2] = right+1; puntos[3] = up-1; puntos[4] = right+1; puntos[5] = down+1; puntos[6] = (right-2); puntos[7] = (down-2); puntos[8] = (right-2); puntos[9] = (up+2); puntos[10] = (left+2); puntos[11] = (up+2); puntos[12] = left+1; puntos[13] = up-1; setcolor(cs2); setfillstyle(SOLID_FILL, cs2); setlinestyle(0, 1, NORM_WIDTH); fillpoly(7, puntos); setcolor(cs1); setfillstyle(SOLID_FILL, cs1); setlinestyle(0, 1, NORM_WIDTH); puntos[0] = left; puntos[1] = up; puntos[2] = left; puntos[3] = down+1; puntos[4] = right+1; puntos[5] = down+1; puntos[6] = (right-2); puntos[7] = (down-2); puntos[8] = (left+3); puntos[9] = (down-2); puntos[10] = (left+3); puntos[11] = (up+3); puntos[12] = left; puntos[13] = up; fillpoly(7, puntos); setcolor(cdf); setfillstyle(SOLID_FILL, cdf); bar(left+3, up+3, right-3, down-3); } void ImprimeBoton2 (int fill, int cdf, int cs1, int cs2, struct boton parm) { int puntos[14]; puntos[0] = parm.left+1; puntos[1] = parm.up-1; puntos[2] = parm.right+1; puntos[3] = parm.up-1; puntos[4] = parm.right+1; puntos[5] = parm.down+1; puntos[6] = (parm.right-2); puntos[7] = (parm.down-2); puntos[8] = (parm.right-2); puntos[9] = (parm.up+2); puntos[10] = (parm.left+2); puntos[11] = (parm.up+2); puntos[12] = parm.left+1; puntos[13] = parm.up-1; setcolor(cs2); setfillstyle(SOLID_FILL, cs2); setlinestyle(0, 1, NORM_WIDTH); fillpoly(7, puntos); setcolor(cs1); setfillstyle(SOLID_FILL, cs1); setlinestyle(0, 1, NORM_WIDTH); puntos[0] = parm.left; puntos[1] = parm.up; puntos[2] = parm.left; puntos[3] = parm.down+1; puntos[4] = parm.right+1; puntos[5] = parm.down+1; puntos[6] = (parm.right-2); puntos[7] = (parm.down-2); puntos[8] = (parm.left+3); puntos[9] = (parm.down-2); puntos[10] = (parm.left+3); puntos[11] = (parm.up+3); puntos[12] = parm.left; puntos[13] = parm.up; fillpoly(7, puntos); if(fill) { setcolor(cdf); setfillstyle(SOLID_FILL, cdf); bar(parm.left+3, parm.up+3, parm.right-3, parm.down-3); } } /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* DibujaPantalla confecciona la pantalla de inicio */ void DibujaPantalla(void) { int i; int x = 30; int y[4] = {30, 150, 270, 390}; char *texto[] = { "Mirar ", "Utilidades ", "Informaci¢n", "Salir "}; setfillstyle(6, 57); floodfill(0, 0, 1); ImprimeBoton(20, 20, 170, 100, 7, 63, 56); ImprimeBoton(20, 140, 170, 220, 7, 63, 56); ImprimeBoton(20, 260, 170, 340, 7, 63, 56); ImprimeBoton(20, 380, 170, 460, 7, 63, 56); setcolor(0); for(i=0; i<4; i++) { outtextxy( x, y[i], texto[i]); outtextxy( x+1, y[i]+6, "-"); } DibujaOjo(); DibujaInfo(); DibujaSalir(); ImprimeBoton(205, 20, 605, 220, 7, 63, 56); ImprimeBoton(213, 29, 302, 209, 0, 56, 63); /* 214 29 302 209 */ ImprimeBoton(322, 29, 596, 209, 0, 56, 63); ImprimeBoton(205, 260, 605, 460, 7, 63, 56); ImprimeBoton(213, 269, 596, 451, 0, 56, 63); /* 214 269 596 451 */ } /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* Realiza el Dibujo del Ojo */ /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ void DibujaOjo(void) { setcolor(0); setlinestyle(0, 0, NORM_WIDTH); ellipse(98, 70, 0, 360, 10, 12); ellipse(120, 65,0, 360, 12, 10); setfillstyle(SOLID_FILL, 6); floodfill(98, 70, 0); floodfill(120, 65, 0); setcolor(0); circle(101, 76, 4); circle(126, 70, 4); setfillstyle(SOLID_FILL, 0); floodfill(101, 76, 0); floodfill(126, 70, 0); pieslice(114, 82, 0, 360, 5); ellipse(116, 88, 185, 360, 15, 5); } /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* Dibuja la 'I' de Info */ /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ void DibujaInfo(void) { setcolor(0); setfillstyle(SOLID_FILL, 62); fillellipse(130, 310, 18, 25); settextstyle(DEFAULT_FONT, HORIZ_DIR, 3); outtextxy(119, 300, "i"); settextstyle(DEFAULT_FONT, HORIZ_DIR, 1); } /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* Dibuja Mi JD */ /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ /* ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ */ void DibujaSalir(void) { setcolor(56); setlinestyle(0, 0, THICK_WIDTH); line(75, 403, 100, 403); /* J */ line(100, 403, 100, 443); /* J */ line(84, 436, 75, 436); /* J */ line(105, 403, 120, 403); /* D */ setcolor(63); line(75, 404, 75, 414); /* J */ line(75, 414, 90, 414); /* J */ line(90, 414, 90, 438); /* J */ line(75, 437, 75, 448); /* J */ line(105, 403, 105, 456); /* D */ line(105, 456, 120, 456); /* D */ arc(88, 443, 180, 353, 13); /* J */ setlinestyle(0, 0, THICK_WIDTH); setcolor(56); setlinestyle(0, 0, THICK_WIDTH); arc(87, 438, 180, 353, 4); /* J */ setlinestyle(0, 0, THICK_WIDTH); ellipse(115, 429, 280, 80, 23, 27); /* D */ } void fundido_al_negro(void) { // int OK=0; typedef union { struct { unsigned char rojo, verde, azul; }color; unsigned char RGB[3]; }DAC; typedef DAC DACARRAY[16]; union REGS regs; struct SREGS sregs; int m,n; DACARRAY Buffer; // Array de 16 estructuras de 3 //obtencion de la paleta a trav‚s de la BIOS. regs.h.ah=0x10; regs.h.al=0x17; regs.x.bx=0; regs.x.cx=16; regs.x.dx=FP_OFF(Buffer); sregs.es=FP_SEG(Buffer); int86x(0x10,®s,®s,&sregs); for(m=0;m<64;m++) // while(!OK) { for(n=0;n<16;n++) { if (Buffer[n].RGB[0]>0) { Buffer[n].RGB[0]--; } if (Buffer[n].RGB[1]>0) { Buffer[n].RGB[1]--; } if (Buffer[n].RGB[2]>0) { Buffer[n].RGB[2]--; } // if (Buffer[n].RGB[1]<=0 && Buffer[n].RGB[1]<=0 && Buffer[n].RGB[2]<=0) OK = 1; } pon_paleta((char*)Buffer, -1); delay(15); } //; } void pon_paleta(char *punt, int bandera) { struct SREGS seg; union REGS regs; unsigned int n; char far *cPaleta, *dir_pal; cPaleta=punt; if(bandera==0){ dir_pal=cPaleta; for(n=12; n>0; n--) { *cPaleta=*cPaleta >> 2; *dir_pal=*cPaleta; cPaleta++;dir_pal++; } } regs.x.ax = 0x1012; regs.x.bx = 0; regs.x.cx = 16; regs.x.dx = FP_OFF(cPaleta); seg.es = FP_SEG(cPaleta); int86x(0x10, ®s, ®s, &seg); // funci¢n para asignar los colores }