GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Dec-2005, 12:32
far far is offline
New Member
 
Join Date: Dec 2005
Posts: 1
far is on a distinguished road

Urgent help needed:mouse position problem


i am developing a simple paint program in c++.
Whenever the user clicks with the mouse pointer on the screen,those coordinates are returned in the function and the pixel ther is switched on BUT the problem is that, whenever i click on the mousepointer instead of the pixel being switched at that point it is swtched on further away from the actual position,Can some body tell me that what the problem might be?

CPP / C++ / C Code:
#include"interface.cpp"

//#include<graphics.h>

int  initmouse();

void showmouseptr();

void restrictmouseptr(int , int , int , int );

void getmousepos(int *, int *, int *);




void main()
{
	mode(19);// function called from tool.cpp to change the mode to graphics
	draw_rec();
	int x1=0;
	int y1=0;
	int  maxx,maxy,  x, y,button;

	showmouseptr();

	int prevx=0;
	int prevy=0;
	while(!kbhit())
	{
		getmousepos(&button,&x,&y);

		if(button ==1 )
		{
			prevx=x;
			prevy=y;
			while(button ==1)
			{
				linebress(prevx,prevy,x,y,4);//function called to switch the pixel on
				prevx = x;
				prevy = y;
				getmousepos(&button ,&x,&y);
			}//end while
			showmouseptr();
		}//end if
	}//end while

getch();

}
void showmouseptr()
{
	r.x.ax=1;
	int86(0x33, &r,&r);
}
 int  initmouse()
{
	r.x.ax=0;
	int86(0x33,&r,&r);
return(r.x.ax);
}
void getmousepos(int *button, int *x, int *y)
 {
	r.x.ax =3;
	int86(0x33, &r,&r);
	*button = r.x.bx;
	*x = r.x.cx;
	*y=r.x.dx;
 }
Last edited by LuciWiz : 03-Dec-2005 at 12:57. Reason: Please insert your C++ code between [c++] & [/c++] tags
 
 

Recent GIDBlogDeveloping GUIs with wxPython (Part 3) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
a significant problem after installing Xp mohammad Computer Software Forum - Windows 10 09-Aug-2005 07:03
Classes problem Requoter C++ Forum 9 03-May-2005 09:44
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 11:28
there are some errors but where?? small_ticket C Programming Language 6 18-May-2004 13:10
urgent: problem + output filters jack Apache Web Server Forum 0 04-Feb-2004 22:32

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:39.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.