Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Author: Shah Hassan
- Date: long/forgot/ten
- Can be run in Turbo C only.
- It's basically a support file, which I include whenever I make programs which require cursor and mouse.
- */
- #include<graphics.h>
- #include<stdlib.h>
- #include<dos.h>
- class Mouse{
- union REGS in,out;
- public:
- Mouse();
- int show();
- void getpos(int&x, int&y, int& click);
- int hide();
- void setpos(int x, int y);
- } crsr;
- Mouse::Mouse() {
- show();
- setpos(10,10);
- }
- int Mouse::show(){
- in.x.ax=1;
- int86(51,&in,&out);
- return 1;
- }
- void Mouse::getpos(int &xpos,int &ypos,int &click){
- //click
- in.x.ax=3;
- int86(51,&in,&out);
- click=out.x.bx;
- xpos=out.x.cx;
- ypos=out.x.dx;
- }
- int Mouse::hide(){
- in.x.ax=2;
- int86(51,&in,&out);
- return 1;
- }
- void Mouse::setpos(int xpos,int ypos) {
- in.x.ax=4;
- in.x.cx=xpos;
- in.x.dx=ypos;
- int86(51,&in,&out);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement