Mail Archives: djgpp/1997/01/22/08:28:06
| From:  | "Don" <6dcb AT qlink DOT queensu DOT ca>
 | 
| Newsgroups:  | comp.os.msdos.djgpp
 | 
| Subject:  | The mouse thing again.
 | 
| Date:  | 22 Jan 1997 00:34:51 GMT
 | 
| Organization:  | Queen's University, Kingston
 | 
| Lines:  | 38
 | 
| Message-ID:  | <01bc07fb$c28c6da0$a3f80f82@default>
 | 
| NNTP-Posting-Host:  | toll2-slip163.tele.queensu.ca
 | 
| To:  | djgpp AT delorie DOT com
 | 
| DJ-Gateway:  | from newsgroup comp.os.msdos.djgpp
 | 
I'd like to thank everyone who responded to my question about the mouse. 
Someone suggested that I give a brief snippet of code showing my problem so
here it goes.
*/
#define MAXX 320 // default coordinates for mode X
#define MAXY 240
// Global mouse structure m
/* 1-319 returned to mx
   1-239 returned to my
*/  
struct m_type{
	signed int mx, my;
}m;
// Get all mouse position using relative mouse position function 11 
void mouse(void) {
	union REGS mou;
	mou.x.ax = 0x0b;
	int86(0x33, &mou, &mou);
	m.mx+=mou.x.cx;
	m.my+=mou.x.dx;
	
	if(m.mx>MAXX)
		m.mx=MAXX;
	if(m.my>MAXY)
		m.my=MAXY;
	if(m.mx<1)
		m.mx=1;
	if(m.my<1)
		m.my=1;
}
Basically the problem is that this works fine under other dos compilers,
but not in djgpp.  Why?  btw.  This is a great way to program the mouse
because you get 1 pixel accuracy.
- Raw text -