delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/08/14:57:43

Xref: news2.mv.net comp.os.msdos.djgpp:3579
From: Shawn Hargreaves <slh100 AT york DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: my allegro problems
Date: Tue, 7 May 1996 10:51:24 +0100
Organization: The University of York, UK
Lines: 37
Message-ID: <Pine.SGI.3.91.960507103739.26168A-100000@tower.york.ac.uk>
NNTP-Posting-Host: tower.york.ac.uk
Mime-Version: 1.0
In-Reply-To: <318e5733.0@131.162.2.91>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On 6 May 1996, Hafiz Awang Pon wrote:

> I've just gotten allegro and i'm trying to work with it. 
> It's seem a useful tool. I'm kinda however having a problem
> with the mouse routine. I'm testing it right now to understand
> here is a short program that i wrote for it.
[...]
> extern volatile int mouse_x;
> extern volatile int mouse_y;
> extern volatile int mouse_b;

You don't need these: they are defined in allegro.h (I should probably be 
clearer about that in the docs).

> i have is that when i move the mouse, it doesn't give the 
> coordinate that i expected. it always gives either the value
> 0 or 8161. Don't get me wrong. I know that the variable 
> mouse_x and mouse_y works. I've compiles and ran the test 

I think it is because your program is running in text mode, and my mouse 
driver assumes that you will be in a graphics mode. There is actually a 
bug that was causing some people to get division by zero errors if they 
moved the mouse after initialising it but before entering graphics mode: 
I can send you a patch if you want, or wait for the next release in a 
couple of weeks time.

For your program, though, you should be able to get working by adding:

set_gfx_mode(GFX_VGA, 320, 200, 0, 0);


/*
 *	Shawn Hargreaves.        Why is 'phonetic' spelt with a ph?
 *	Check out Allegro and FED on http://www.york.ac.uk/~slh100/
 */


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019