void Accion (struct TipoMensaje *p) { int Boton,Vert,Horiz,c; p->Boton = mouse.Estado (&p->X, &p->Y); getch1(&p->Llave); while (p->Boton == 0 && p->Llave == 0) { p->Boton = mouse.Estado (&p->X, &p->Y); getch1(&p->Llave); } if (p->Boton != 0) p->Tipo = Boton; else p->Tipo = 4; }
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(); }
int main() { int unidad = DETECT, modo,i,Vert,Horiz,Boton; MOUSE mouse; void uno(MOUSE &),dos(MOUSE &); void tres(MOUSE &),cuatro(MOUSE &),cinco(MOUSE &); void EscribirMenu(MOUSE &); mouse.Inicializar(); initgraph (&unidad,&modo,"c:\\bc\\bgi"); if (graphresult() != 0) { cout << "Error al tratar de pasar al modo grafico\n"; getch(); return 1; } mouse.Mostrar(); EscribirMenu(mouse); Boton = 0; while (Boton != DERECHO) { Boton = mouse.Estado(&Vert, &Horiz); if (Boton == IZQUIERDO) { if (Horiz >= 50 && Horiz <= 59) { uno(mouse); EscribirMenu(mouse); } else if (Horiz >= 60 && Horiz <= 69) { dos(mouse); EscribirMenu(mouse); } else if (Horiz >= 70 && Horiz <= 79) { tres(mouse); EscribirMenu(mouse); } else if (Horiz >= 80 && Horiz <= 89) { cuatro(mouse); EscribirMenu(mouse); } else if (Horiz >= 90 && Horiz <= 99) { cinco(mouse); EscribirMenu(mouse); } mouse.LibBotones(); } } closegraph(); return 0; }
int main() { int unidad = DETECT, modo,boton,Horiz,Vert; char a[10],todo[30]; MOUSE mouse; mouse.Inicializar(); initgraph (&unidad,&modo,"c:\\bc\\bgi"); if (graphresult() != 0) { cout << "Error al tratar de pasar al modo grafico\n"; getch(); return 1; } mouse.Mostrar(); getch(); boton = mouse.Estado (&Vert,&Horiz); itoa (Horiz,a,10); strcpy (todo,a); itoa (Vert,a,10); strcat (todo," "); strcat (todo,a); itoa (boton,a,10); strcat (todo," "); strcat (todo,a); mouse.Esconder(); outtextxy (0,0,todo); mouse.Mostrar(); getch(); boton = mouse.Estado (&Vert,&Horiz); itoa (Horiz,a,10); strcpy (todo,a); itoa (Vert,a,10); strcat (todo," "); strcat (todo,a); itoa (boton,a,10); strcat (todo," "); strcat (todo,a); mouse.Esconder(); outtextxy (0,10,todo); mouse.Mostrar(); getch(); boton = mouse.Estado (&Vert,&Horiz); itoa (Horiz,a,10); strcpy (todo,a); itoa (Vert,a,10); strcat (todo," "); strcat (todo,a); itoa (boton,a,10); strcat (todo," "); strcat (todo,a); mouse.Esconder(); outtextxy (0,20,todo); mouse.Mostrar(); getch(); closegraph(); return 0; }