File name: video.cpp/video.h


Variables


The vga video memory
***********************************************************************
static byte *vga = (byte*)0xA0000;


The position where the "imprimir" function can write, the increases are given by:
height: LARGO_CHAR=9 and weight: ANCHO_CHAR=8
***********************************************************************
extern unsigned int x_char,y_char;


Functions


Effect: clear the screen with a BLACK color
Require: video mode initialized
***********************************************************************
byte esperarClickImprimirCursor();


Effect: print a string with a letter and background color in the
          row "fila", "hacerEffecto" refers to play a sound and
          make a delay while writting.
Require: video mode initialized
***********************************************************************
void imprimirCentro(
    char *hilera,
    byte colorLetra,
    byte colorFondo,
    int fila,
    bool hacerEffecto);


Effect: write values to the vga registers, needed to initialize the
          640x480x16 video mode
Require: an array of values, for example "g_640x480x16"
Credits: to Chris Giese
***********************************************************************/
void write_regs(unsigned char *regs);


Effect: paint a pixel in the position (x,y) with a color
Require: video mode initialized, a one plane mode
***********************************************************************
void pintarPixel1(int x,int y,byte color);


Effect: paint a point of "tamanio" number of pixel in the position
         (x,y) with a color
Require: video mode initialized
***********************************************************************
void pintarPixel1(
    int x,
    int y,
    byte color,
    int tamanio);


Effect: paint a pixel in the position (x,y) with a color
Require: video mode initialized, a two planes mode
***********************************************************************
void pintarPixel2(int x,int y,byte color);


Effect: paint a square of (largo)x(ancho) in the point (x0,y0)
Require: video mode initialized
***********************************************************************
void limpiarPantalla(
    int x0,
    int y0,
    int largo,
    int ancho,
    byte color);


Effect: paint in the screen a character defined in the video.h
          as a byte matrix at the point (x,y) of a letter and
          background specific color
Require: video mode initialized
***********************************************************************
void pintarChar(
    byte elChar[LARGO_CHAR*ANCHO_CHAR],
    int x,int y,
    byte colorChar,byte colorFondo);


Effect: same that "pintarChar" but uses a char instead of a
          byte matrix. If the char has not a byte matrix defined
          it prints '?'.
Require: video mode initialized, it uses x_char and y_char.
***********************************************************************
void imprimir(
    char* hilera,
    byte colorChar,
    byte colorFondo);


Effect: same as "imprimir" but print a string instead of a char.
Require: video mode initialized, it uses x_char and y_char.
***********************************************************************
void imprimir(
    char* hilera,
    byte colorChar,
    byte colorFondo,
    bool hacerEffecto);


Effect: fill the screen with columns of the word "hilera" using
         red, black and white colors.
Require: video mode initialized, it uses x_char and y_char.
***********************************************************************
void llenarPantallaHilera(char* hilera);


Effect: auxiliar function of "llenarPantallaHilera"
Require: video mode initialized, it uses x_char and y_char.
***********************************************************************
void llenarPantallaHileraAux(
    char* hilera,
    byte elColorChar,
    byte elColorFondo,
    int residuo);


Effect: paint a square of "largo" size in the position
         (columna,fila) with a border and two background colors
Require: video mode initialized
***********************************************************************
void imprimirCuadrado(
    int fila,
    int columna,
    int largo,
    byte colorLinea,
    byte colorRelleno1,
    byte colorRelleno2);


Effect: paint a square of "largo" size in the position
         (columna,fila) with a border, two background colors and
         two background colors of a shadow (edge outside the
         square ). The shape can be rotated "angulo" grades.
Require: video mode initialized
***********************************************************************
void imprimirCuadrado(
    int x0,int y0,int largo,double angulo,
    int porcentajeSombra,int porcentajeEsquina,
    byte colorLinea,byte colorRelleno1,
    byte colorRelleno2, byte colorSombra1,
    byte colorSombra2);


Effect: paint a line between (x1,y1) and (x2,y2) with two
         alternating colors. The "porcentaje" refers to the percent
         of the extremity sides of the line that must be printed
         with a bigger pixel's point, use "tamanioPuntoEsquina"
         to define the size of this point. If "porcentaje = 100" then
         all the line is painted grosser.
Require: video mode initialized
***********************************************************************
void imprimirLinea(
    int x1,int y1,
    int x2,int y2,
    byte color1,byte color2,
    double porcentaje,
    int tamanioPuntoEsquina);


Effect: prints in the point (x0,y0) an arch (portion of a circle radio)
          using polar coordinates.
Require: video mode initialized
***********************************************************************
void imprimirArco(
    int x0,int y0,int radio,byte colorLinea,
    int anguloInicio,int anguloFinal);


Effect: print a double in the screen. ie: 0.05 : "000000005x05"
Require: video mode initialized, uses x_char and y_char
***********************************************************************
void imprimirDouble(double x);