#include <math.h>
#include <conio.h>
#include <iostream>
#include <winbgim.h>
#include <stdlib.h>
//#include <cstdlib.h>
using namespace std;
const int ANCHO = 720, ALTO = 720;
void titulo(int x, int y, char *n=" "){
outtextxy(x,y,n);
}
int prueba(int x, int y)
{
rectangle(x,y,x+70,y+20);
if(mousex()>x && mousex()<x+70 && mousey()>y && mousey()<y+20 && ismouseclick(WM_LBUTTONDOWN))
{
clearmouseclick(WM_LBUTTONDOWN);
return 1;
}
else
{
clearmouseclick(WM_LBUTTONDOWN);
return 0;
}
}
void estado (int x, int y, int c1, int c2)
{
if(mousex()>x && mousex()<x+70 && mousey()>y && mousey()<y+20 )
{
setcolor(c1);
}
else
{
setcolor(c2);
}
}
/*****************************************************************************************************************************/
int main(int argc, char *argv[]) {
initwindow( 400, 400, "Botón para salir", 300,200 );
setbkcolor(RGB(63,199,168));
cleardevice();
while(true)
{
titulo(100,40,"SALIR");
estado(100,42,2,15);
if (prueba(90,40))
{return 0;}
}
getch();
}