First commit 09/12/1994
This commit is contained in:
167
CRATON.CPP
Normal file
167
CRATON.CPP
Normal file
@ -0,0 +1,167 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
///// Nombre: Craton.cpp ///
|
||||
///// Modulo: Perteneciente a Catalogo.C ///
|
||||
//// Descripci<63>n: Utilidades para el manejo del raton ///
|
||||
//// ///
|
||||
//// Autor: ( Ver Pc-Mania n<> 20 ) ///
|
||||
//// Autor puntero del raton: Jos<6F> David Guill<6C>n Dominguez ///
|
||||
//// Fecha: ( Desconocida ) ///
|
||||
//// ///
|
||||
//// Compilador Borland C++ 3.0 ( Creaci<63>n original en Turbo C 2.0 ) ///
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <dos.h>
|
||||
|
||||
void desactiva_raton(void);
|
||||
void activa_raton(void);
|
||||
void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py);
|
||||
|
||||
int raton=0;
|
||||
int x_raton;
|
||||
int y_raton;
|
||||
int boton_izq;
|
||||
int boton_der;
|
||||
extern int PunteroRaton;
|
||||
int dir_raton [32+32] = {
|
||||
|
||||
// 0x3FFF, /*<2A> <20> 1 1 1 1 1 1 1 1 1 1 1 1 1 1*/
|
||||
// 0x1FFF, /*<2A> <20> <20> 1 1 1 1 1 1 1 1 1 1 1 1 1*/
|
||||
// 0x0FFF, /*<2A> <20> <20> <20> 1 1 1 1 1 1 1 1 1 1 1 1*/
|
||||
// 0x07FF, /*<2A> <20> <20> <20> <20> 1 1 1 1 1 1 1 1 1 1 1*/
|
||||
// 0x03FF, /*<2A> <20> <20> <20> <20> <20> 1 1 1 1 1 1 1 1 1 1*/
|
||||
// 0x07FF, /*<2A> <20> <20> <20> <20> 1 1 1 1 1 1 1 1 1 1 1*/
|
||||
// 0xC3FF, /*1 1 <20> <20> <20> <20> 1 1 1 1 1 1 1 1 1 1*/
|
||||
|
||||
0x007F, /*<2A> <20> <20> <20> <20> <20> <20> <20> <20> 1 1 1 1 1 1 1*/
|
||||
0x00FF, /*<2A> <20> <20> <20> <20> <20> <20> <20> 1 1 1 1 1 1 1 1*/
|
||||
0x01FF, /*<2A> <20> <20> <20> <20> <20> <20> 1 1 1 1 1 1 1 1 1*/
|
||||
0x01FF, /*<2A> <20> <20> <20> <20> <20> <20> 1 1 1 1 1 1 1 1 1*/
|
||||
0x00FF, /*<2A> <20> <20> <20> <20> <20> <20> <20> 1 1 1 1 1 1 1 1*/
|
||||
0x007F, /*<2A> <20> <20> <20> <20> <20> <20> <20> <20> 1 1 1 1 1 1 1*/
|
||||
0x18FF, /*<2A> <20> <20> 1 1 <20> <20> <20> 1 1 1 1 1 1 1 1*/
|
||||
|
||||
// 0xFC7F, /*1 1 1 1 1 1 <20> <20> <20> 1 1 1 1 1 1 1*/
|
||||
// 0xF83F, /*1 1 1 1 1 <20> <20> <20> <20> <20> 1 1 1 1 1 1*/
|
||||
// 0xF01F, /*1 1 1 1 <20> <20> <20> <20> <20> <20> <20> 1 1 1 1 1*/
|
||||
// 0xE00F, /*1 1 1 <20> <20> <20> <20> <20> <20> <20> <20> <20> 1 1 1 1*/
|
||||
// 0xE00F, /*1 1 1 <20> <20> <20> <20> <20> <20> <20> <20> <20> 1 1 1 1*/
|
||||
// 0xF83F, /*1 1 1 1 1 <20> <20> <20> <20> <20> 1 1 1 1 1 1*/
|
||||
// 0xF83F, /*1 1 1 1 1 <20> <20> <20> <20> <20> 1 1 1 1 1 1*/
|
||||
|
||||
0x800F, /*1 <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> 1 1 1 1*/
|
||||
0x8083, /*1 <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> 1 1*/
|
||||
0x8001, /*1 <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> 1*/
|
||||
0xF810, /*1 1 1 1 1 <20> <20> <20> <20> <20> <20> 1 <20> <20> <20> 1*/
|
||||
0x8810, /*1 <20> <20> <20> 1 <20> <20> <20> <20> <20> <20> 1 <20> <20> <20> 1*/
|
||||
0x8811, /*1 <20> <20> <20> 1 <20> <20> <20> <20> <20> <20> 1 <20> <20> <20> 1*/
|
||||
0x8003, /*1 <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> 1 1*/
|
||||
0x8007, /*1 <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> 1 1 1*/
|
||||
0x800F, /*1 <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> <20> 1 1 1 1*/
|
||||
|
||||
// 0x0000, /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/
|
||||
// 0x4000, /*0 <20> 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/
|
||||
// 0x6000, /*0 <20> <20> 0 0 0 0 0 0 0 0 0 0 0 0 0*/
|
||||
// 0x7000, /*0 <20> <20> <20> 0 0 0 0 0 0 0 0 0 0 0 0*/
|
||||
// 0x7800, /*0 <20> <20> <20> <20> 0 0 0 0 0 0 0 0 0 0 0*/
|
||||
// 0x3000, /*0 0 <20> <20> 0 0 0 0 0 0 0 0 0 0 0 0*/
|
||||
// 0x1800, /*0 0 0 <20> <20> 0 0 0 0 0 0 0 0 0 0 0*/
|
||||
|
||||
0x0000, /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/
|
||||
0x7E00, /*0 <20> <20> <20> <20> <20> <20> 0 0 0 0 0 0 0 0 0*/
|
||||
0x7C00, /*0 <20> <20> <20> <20> <20> 0 0 0 0 0 0 0 0 0 0*/
|
||||
0x7C00, /*0 <20> <20> <20> <20> <20> 0 0 0 0 0 0 0 0 0 0*/
|
||||
0x7E00, /*0 <20> <20> <20> <20> <20> <20> 0 0 0 0 0 0 0 0 0*/
|
||||
0x6700, /*0 <20> <20> 0 0 <20> <20> <20> 0 0 0 0 0 0 0 0*/
|
||||
0x0200, /*0 0 0 0 0 0 <20> 0 0 0 0 0 0 0 0 0*/
|
||||
|
||||
|
||||
// 0x0100, /*0 0 0 0 0 0 0 <20> 0 0 0 0 0 0 0 0*/
|
||||
// 0x0380, /*0 0 0 0 0 0 <20> <20> <20> 0 0 0 0 0 0 0*/
|
||||
// 0x07C0, /*0 0 0 0 0 <20> <20> <20> <20> <20> 0 0 0 0 0 0*/
|
||||
// 0x0FE0, /*0 0 0 0 <20> <20> <20> <20> <20> <20> <20> 0 0 0 0 0*/
|
||||
// 0x0380, /*0 0 0 0 0 0 <20> <20> <20> 0 0 0 0 0 0 0*/
|
||||
// 0x0380, /*0 0 0 0 0 0 <20> <20> <20> 0 0 0 0 0 0 0*/
|
||||
// 0x0000, /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/
|
||||
|
||||
0x0000, /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/
|
||||
0x3E70, /*0 0 <20> <20> <20> <20> <20> 0 0 <20> <20> <20> 0 0 0 0*/
|
||||
0x0248, /*0 0 0 0 0 0 <20> 0 0 <20> 0 0 <20> 0 0 0*/
|
||||
0x0244, /*0 0 0 0 0 0 <20> 0 0 <20> 0 0 0 <20> 0 0*/
|
||||
0x0242, /*0 0 0 0 0 0 <20> 0 0 <20> 0 0 0 <20> 0 0*/
|
||||
0x2244, /*0 0 <20> 0 0 0 <20> 0 0 <20> 0 0 0 <20> 0 0*/
|
||||
0x2248, /*0 0 <20> 0 0 0 <20> 0 0 <20> 0 0 <20> 0 0 0*/
|
||||
0x3E70, /*0 0 <20> <20> <20> <20> <20> 0 0 <20> <20> <20> 0 0 0 0*/
|
||||
0x0000 /*0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0*/
|
||||
};
|
||||
|
||||
|
||||
void inicializa_raton_grafico(int x1, int y1, int x2, int y2, int px, int py)
|
||||
{
|
||||
struct SREGS seg;
|
||||
union REGS ent, sal;
|
||||
long dir;
|
||||
|
||||
ent.x.ax = 0;
|
||||
int86(0x33, &ent, &sal); /* averigua si hay rat<61>n conectado */
|
||||
|
||||
raton = sal.x.ax; /* indica a la variable global el estado
|
||||
del raton */
|
||||
|
||||
if(raton!=0) {
|
||||
|
||||
|
||||
ent.x.ax = 15;
|
||||
ent.x.cx = 5;
|
||||
ent.x.dx = 11;
|
||||
int86(0x33, &ent, &sal); /* fija la raz<61>n mickey/pixel */
|
||||
|
||||
ent.x.ax = 7;
|
||||
ent.x.cx = x1;
|
||||
ent.x.dx = x2;
|
||||
int86(0x33, &ent, &sal); /* fija la posici<63>n m<>x. y m<>n. horizontal */
|
||||
|
||||
ent.x.ax = 8;
|
||||
ent.x.cx = y1;
|
||||
ent.x.dx = y2;
|
||||
int86(0x33, &ent, &sal); /* fija la posici<63>n m<>x. y m<>n. vertical */
|
||||
|
||||
if(!PunteroRaton) {
|
||||
dir = (long)dir_raton;
|
||||
ent.x.ax = 9;
|
||||
ent.x.bx = 0;
|
||||
ent.x.cx = 0;
|
||||
ent.x.dx = (int) dir;
|
||||
seg.es = (int) (dir >> 16);
|
||||
int86x(0x33, &ent, &sal, &seg); /* asigna un cursor diferente */
|
||||
}
|
||||
|
||||
ent.x.ax = 4;
|
||||
ent.x.cx = px;
|
||||
x_raton=ent.x.cx >> 1;
|
||||
ent.x.dx = py;
|
||||
y_raton=ent.x.dx;
|
||||
int86(0x33, &ent, &sal); /* fija la posici<63>n del rat<61>n */
|
||||
|
||||
ent.x.ax = 1;
|
||||
int86(0x33, &ent, &sal); /* muestra el puntero del rat<61>n */
|
||||
}
|
||||
}
|
||||
|
||||
void activa_raton(void)
|
||||
{
|
||||
union REGS ent, sal;
|
||||
|
||||
ent.x.ax = 1;
|
||||
int86(0x33, &ent, &sal);
|
||||
}
|
||||
|
||||
void desactiva_raton(void)
|
||||
{
|
||||
union REGS ent, sal;
|
||||
|
||||
ent.x.ax = 2;
|
||||
int86(0x33, &ent, &sal);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user