Hi everybody,
i wanna enable concole mouse point in BGI GRAPHIC , i need urs Help ,
if u know how to Enable Mouse In C++ ( BGI GRAPHIC ) then reply me plz!
i hv also a code of mouse pointer , BUT i can't understand This code ,
No Error In Code.
Code:
#include<iostream.h>
#include<conio.h>
#include<process.h>
#include<graphics.h>
#include<dos.h>
/*
void showptr();
void restrictptr(int,int,int,int);
void getmpos(int*,int*,int*);
int initmouse();
void setmpos(int,int);
void hideptr();
*/
class mouse
{
private:
union REGS i,o;
struct SREGS s;
public:
/************* Initialize Mouse ********************/
int initmouse()
{
i.x.ax=0;
int86(0x33,&i,&o);
return (o.x.ax);
}
/************* Display Pointer *********************/
void showptr()
{
i.x.ax=1;
int86(0x33,&i,&o);
}
/************* Restrict Mouse Movement *************/
void restrictptr(int x1,int y1,int x2,int y2)
{
i.x.ax=7;
i.x.cx=x1;
i.x.dx=x2;
int86(0x33,&i,&o);
i.x.ax=8;
i.x.cx=y1;
i.x.dx=y2;
int86(0x33,&i,&o);
}
/********** Get Mouse Position ***************/
void getmpos(int *button,int *xx,int *yy)
{
i.x.ax=3;
int86(0x33,&i,&o);
*button=o.x.bx;
*xx=o.x.cx;
*yy=o.x.dx;
}
/********** Set Pointer Position **************/
void setmpos(int xx,int yy)
{
i.x.ax=4;
int86(0x33,&i,&o);
xx=o.x.cx;
yy=o.x.dx;
}
/***************HIDE MOUSE *********************/
void hideptr()
{
i.x.ax=2;
int86(0x33,&i,&o);
}
};
// end mouse class